Restored from previous forum. Originally posted by PB.
> i would need a function which sends keystrokes to a handle of another window.
> something like sendstring(handle, "{F1}") to open the help or so...
To do specifically what you requested above, open a new Notepad window and then
use this code:
Code: Select all
handle=findwindow_(0,"Untitled - Notepad") ; Gets handle of Notepad window.
PostMessage_(handle,#WM_KEYDOWN,#VK_F1,0) ; Pushes the F1 key down on it.
PostMessage_(handle,#WM_KEYUP,#VK_F1,0) ; Releases the F1 key from it.
The best part is that using PostMessage doesn't require the Notepad window
to have the focus, so it can be in the background and still have F1 pressed.
PB - Registered PureBasic Coder
Edited by - PB on 14 July 2002 23:57:29