What am I doing wrong (Win API stuff, 2nd part)
This is my code:
---------------------- Start code --------------------------
procedure TForm1.btnDailyBackupClick(Sender: TObject);
var
MyHandle: HWND;
ProgramPath: PChar;
Msg: Char;
S: string;
begin
Msg := 't';
ProgramPath := StrAlloc(256);
StrPCopy(ProgramPath, '\windows\notepad.exe');
ShellExecute(0,nil,ProgramPath,nil,nil,SW_SHOWNORMAL);
MyHandle := FindWindow('Notepad',nil);
SendMessage(MyHandle,WM_CHAR,null,Word(Msg));
end;
---------------------- End code --------------------------
As I step through the code, everything goes fine until I reach the
SendMessage line. It gives me an error:
Project XXXXX raised exception class EVariantError with message 'Invalid
variant type conversion'.
Say wha??????
--
Joseph I. Ceasar (Yossi)
CLS Computer Solutions