SendMessage or PostMessage ?

01/25/2013 12:49 newbie2013#1
How do i simulate keypress in C++ Builder ?
SendMessage or PostMessage ?

A Example would be really nice, im new to this all :o
01/25/2013 13:20 Sᴡoosh#2
Both suck, but if you want to send keys... use postmessage, since it doesn't wait for response from target handle.
01/25/2013 13:43 newbie2013#3
Thanks Swoosh,
PostMessage work for me even on Hiden Window
Quote:
PostMessage(hWnd, WM_KEYDOWN, VK_ESCAPE, MapVirtualKey(VK_ESCAPE, 0));
PostMessage(hWnd, WM_KEYUP, VK_ESCAPE, MapVirtualKey(VK_ESCAPE, 0));
What you mean with
Quote:
Originally Posted by Sᴡoosh View Post
Both suck
Is there a better/safer Way to send Keys ?
01/25/2013 14:12 Sᴡoosh#4
Don't send keys at all would be the better way :) No unfreezing, no chat problems... etc.
01/26/2013 12:40 Interest07#5
Quote:
Originally Posted by Sᴡoosh View Post
Don't send keys at all would be the better way :) No unfreezing, no chat problems... etc.
It is by far the quickest method to create really specialist small tools though when you haven't dug through all the code yet and don't intend on doing that :p

I found myself recently switching to OCR + keysending for some small things in a different game, because I couldn't be bothered to do all the other work :o