Hi.
I want to do something that already exists in VB : SendKeys, but in win32asm.
It types a string like the physical user would have typed it with a keyboard in an application.
Is there a "ready to use" proc ?
Or any clue to make my own ?
Is there a SendKeys equivalent in VC++, C++ Builder or Delphi ? (because i don't like VB very much).
Thanks in advance.
how about keybd_event or SendMessage with the WM_CHAR message?
Thank for your quick answer...
I tried :
invoke SendMessage, 50408, WM_CHAR, ADDR Text, NULL
where 50408 is the notepad handle...
But my text doesn't appear in notepad :(
I tried without the ADDR, but same result...
Can you help me a bit more please ? Maybe with a little example ? :)
Thank you :)
sorry, i don't have any examples, never tried it, but try the same with PostMessage. notice that you can only send ONE character to the other window, so you've to use the following for example:
.data
char1 db "A",0
be sure that you've the correct window handle. and try the value 0,1,and 31 as the last parameter.
hope that helpsHere is my basic SendKey routine:
PROC SendKey hWnd: DWord, KeyStroke: Word
Invoke PostMessage hWnd, WM_SETFOCUS, 0, 0
Invoke PostMessage hWnd, WM_KEYDOWN, KeyStroke, 0
Invoke PostMessage hWnd, WM_KEYUP, KeyStroke, 0
ret
ENDP SendKey
You need to have the input window gain focus, then
send a keyup and keydown sequence to that window using
the characters you want sent.
Example of use
Invoke SendKey NPhWnd, 'A'
This will send the letter A to the Input focus window.
I have used a routine in Delphi similar to this and it works.
Hope this helps.
Thank you a lot !
It worked well :).
But i didn't need of Invoke PostMessage, hWnd, WM_KEYUP, KeyStroke, 0
WM_KEYDOWN was enough. :)
Thank you again and happy coding :).