Mario Brocchi wrote in message <35741FF7...@siosistemi.it>...
>I wonder if anybody knows the corresponding of the VB5 command
>"Sendkeys" in Delphi 3.0.
What SendKeys does in VB ???
Use the keybd_event function.
regards,
Kaufman Alex.
Mario,
for short key sequences you can use the keybd_event API function:
Procedure PostVKey( vkey: Byte );
Begin
keybd_event( vkey, MapVirtualkey(vkey, 0), 0, 0 );
keybd_event( vkey, MapVirtualkey(vkey, 0), KEYEVENTF_KEYUP, 0 );
End;
Procedure PostText( hw: HWND; Const S: String );
Var
i: Integer;
Begin
For i:= 1 To Length(S) Do
PostVkey( Ord(UpCase(S[i]))) ;
End;
Key events manufactured this way go the window with focus. For more complex
things a WH_JOURNALPLAYBACK hook is recommended, an example can be found on
http://www.inprise.com/delphi/papers/winAPI/part2.html
Peter Below (TeamB) 10011...@compuserve.com)
It sends a set of keystrokes to another application. For a good
Delphi example, see http://www.fredsterware.com/delphi.htm.
Erik
To send one of those messages to your control, use the Delphi Perform
method. Example:
Memo1.Perform(WM_KeyDown, VK_F2, 0) sends your memo the F2 (function) key.
(One mistake I keep making is forgetting to qualify Perform with the
particular control, in which case nothing will appear to happen.)