Mahatesh
10-21-2016, 23:24
How do you send keystrokes to the tibia11 client?
This is my sample code (shift + F2):
SendMessage(Util.Handle, Constants.WM_KEYDOWN, (IntPtr)0x10, (IntPtr)0x2A0001);
SendMessage(Util.Handle, Constants.WM_KEYDOWN, (IntPtr)0x71, (IntPtr)0x3C0001);
SendMessage(Util.Handle, Constants.WM_KEYUP, (IntPtr)0x71, (IntPtr)0x3C0001);
SendMessage(Util.Handle, Constants.WM_KEYUP, (IntPtr)0x10, (IntPtr)0x2A0001);
But instead of sending shift+F2, it sends just F2 (or at least, thats the hotkey that is activated)
When I look at spy++, it seems that my fake sends are not the same as actual key presses, key event-wise (pic (http://imgur.com/a/swRwe)).
I don't know spy++ well enough to understand the s/r/p flag, but I wonder if you also use WinAPI to send keys, or do you have another way to send keys to a window that isn't necessarily the focused window.
UPDATE:
I switched to PostMessage, and spy++ shows the EXACT same messages. Same issue as before.
This is my sample code (shift + F2):
SendMessage(Util.Handle, Constants.WM_KEYDOWN, (IntPtr)0x10, (IntPtr)0x2A0001);
SendMessage(Util.Handle, Constants.WM_KEYDOWN, (IntPtr)0x71, (IntPtr)0x3C0001);
SendMessage(Util.Handle, Constants.WM_KEYUP, (IntPtr)0x71, (IntPtr)0x3C0001);
SendMessage(Util.Handle, Constants.WM_KEYUP, (IntPtr)0x10, (IntPtr)0x2A0001);
But instead of sending shift+F2, it sends just F2 (or at least, thats the hotkey that is activated)
When I look at spy++, it seems that my fake sends are not the same as actual key presses, key event-wise (pic (http://imgur.com/a/swRwe)).
I don't know spy++ well enough to understand the s/r/p flag, but I wonder if you also use WinAPI to send keys, or do you have another way to send keys to a window that isn't necessarily the focused window.
UPDATE:
I switched to PostMessage, and spy++ shows the EXACT same messages. Same issue as before.