Page 1 of 1
Posted: Fri Jul 12, 2002 10:08 pm
by BackupUser
Restored from previous forum. Originally posted by crono.
Hi there ^^
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...
if you need a more specific example, just say so
kind regards,
Alexander Schoenfeld
Email: [url]mailto:
alexander.schoenfeld@chronologic.de[/url]
Posted: Sat Jul 13, 2002 10:01 am
by BackupUser
Restored from previous forum. Originally posted by fweil.
OK but does the Addkeyboardshortcut apply ? Because you can link a key use to a specific window ...
If you want F1 to launch Help in WindowY when you are in windowX just use addkeyboardshortcut(WindowX, #PB_Shortcut_F1, YourEventNumber) after creating WindowX and then transfer the focus to WindowY ( usewindow(WindowY) ) in the event management instructions.
Does'nt it help so ?
Francois Weil
14, rue Douer
F64100 Bayonne
Posted: Sat Jul 13, 2002 10:10 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.
>> AddKeyboardShortcut(#Window, Shortcut, EventID)
#Window is the PureBasic number of the Window,
not the windows handle - so you cant use it
for windows you have not created yourself.
You could try to use FindWindow_() and after
that send a #WM_CHAR message to the window you found.
cya,
...Danilo
(registered PureBasic user)
Posted: Sat Jul 13, 2002 9:08 pm
by BackupUser
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
Posted: Thu Aug 08, 2002 10:52 am
by BackupUser
Restored from previous forum. Originally posted by crono.
hm... that sure is a way to hit F1, but what if i want notepad to write "hello world!", then simulate Ctrl+S ?
kind regards,
Alexander Schoenfeld
Email: [url]mailto:
alexander.schoenfeld@chronologic.de[/url]
Posted: Thu Aug 08, 2002 11:16 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> hm... that sure is a way to hit F1, but what if i want notepad to
> write "hello world!", then simulate Ctrl+S ?
A quick search of these forums reveals this link:
viewtopic.php?t=1678
PB - Registered PureBasic Coder