Hi everyone.
I try to send keys to the game aion (I guess you understand the reason).
To be able to do it in background, I'm using the Postmessage function and that's where things become weird.
Keys that I send are received if I am in a chat window with the caret. Some keys are processed by the game if not in chat window but mains keys (movement, jump...) are discarded.
I used Spy++ to log messages received by the game and there are no differences in those messages between the key I send (for instance space) and when I press the space bar in the game.
Anyone has an idea ?
Code used to send key:
PostMessage(whandle, 0x100, 0x20, 0x390001);
Thread.Sleep(150);
PostMessage(whandle, 0x101,0x20, 0xC0390001);
Here are the result of messages received by the application.
With space bar in game
<00001> 000A0834 P WM_KEYDOWN nVirtKey:VK_SPACE cRepeat:1 ScanCode:39 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00002> 000A0834 P WM_CHAR chCharCode:'32' (32) cRepeat:1 ScanCode:39 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00003> 000A0834 P WM_KEYUP nVirtKey:VK_SPACE cRepeat:1 ScanCode:39 fExtended:0 fAltDown:0 fRepeat:1 fUp:1
With code above
<00004> 000A0834 P WM_KEYDOWN nVirtKey:VK_SPACE cRepeat:1 ScanCode:39 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00005> 000A0834 P WM_CHAR chCharCode:'32' (32) cRepeat:1 ScanCode:39 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00006> 000A0834 P WM_KEYUP nVirtKey:VK_SPACE cRepeat:1 ScanCode:39 fExtended:0 fAltDown:0 fRepeat:1 fUp:1
I tried to give the focus to the window first using
SetForegroundWindow(whandle);
Same result.
All suggestions are welcome :wave: