| View previous topic :: View next topic |
| Author |
Message |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Sun Nov 30, 2008 5:04 pm Post subject: PostMessage |
|
|
Why this isn't working: | Code: | int lParam = MapVirtualKey(VK_NUMPAD1, MAPVK_VK_TO_VSC) << 16;
lParam |= 0x00000001;
PostMessage(hDROD, WM_KEYDOWN, VK_NUMPAD1, lParam);
lParam |= 0xC0000001;
PostMessage(hDROD, WM_KEYUP, VK_NUMPAD1, lParam); |
Spy++:
My code: | Code: | <00001> 007507A2 P WM_KEYDOWN nVirtKey:VK_NUMPAD1 cRepeat:1 ScanCode:4F fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00002> 007507A2 P WM_KEYUP nVirtKey:VK_NUMPAD1 cRepeat:1 ScanCode:4F fExtended:0 fAltDown:0 fRepeat:1 fUp:1 |
Real keyboard: | Code: | <00021> 00430788 P WM_KEYDOWN nVirtKey:VK_NUMPAD1 cRepeat:1 ScanCode:4F fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00022> 00430788 P WM_KEYUP nVirtKey:VK_NUMPAD1 cRepeat:1 ScanCode:4F fExtended:0 fAltDown:0 fRepeat:1 fUp:1 |
The messages are getting thru, but nothing happens in the other window?
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sun Nov 30, 2008 5:13 pm Post subject: Re: PostMessage |
|
|
| Jani wrote: | Why this isn't working: | Code: | int lParam = MapVirtualKey(VK_NUMPAD1, MAPVK_VK_TO_VSC) << 16;
lParam |= 0x00000001;
PostMessage(hDROD, WM_KEYDOWN, VK_NUMPAD1, lParam);
lParam |= 0xC0000001;
PostMessage(hDROD, WM_KEYUP, VK_NUMPAD1, lParam); |
Spy++:
My code: | Code: | <00001> 007507A2 P WM_KEYDOWN nVirtKey:VK_NUMPAD1 cRepeat:1 ScanCode:4F fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00002> 007507A2 P WM_KEYUP nVirtKey:VK_NUMPAD1 cRepeat:1 ScanCode:4F fExtended:0 fAltDown:0 fRepeat:1 fUp:1 |
Real keyboard: | Code: | <00021> 00430788 P WM_KEYDOWN nVirtKey:VK_NUMPAD1 cRepeat:1 ScanCode:4F fExtended:0 fAltDown:0 fRepeat:0 fUp:0
<00022> 00430788 P WM_KEYUP nVirtKey:VK_NUMPAD1 cRepeat:1 ScanCode:4F fExtended:0 fAltDown:0 fRepeat:1 fUp:1 |
The messages are getting thru, but nothing happens in the other window? |
proly cause
MapVirtualKey (key,0) << 16)
_________________
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Dec 01, 2008 4:14 am Post subject: Re: PostMessage |
|
|
| kitterz wrote: | proly cause
MapVirtualKey (key,0) << 16) | ..Do you know what's the point of it? It sets the scancode and I've confirmed that with scancode 0x00 it doesn't work.
Guess I'll have to focus on the app and then just SendInput.
EDIT: SendInput seems to fail too, altho it's return value is indicating that it succeeded. O_o Hmm.. OnScreen keyboard seems to work. I wonder if the game is processing input directly from keyboard.
So, I think the question is now how to send input to SDL based game?
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Mon Dec 01, 2008 6:31 am Post subject: |
|
|
| I tried this code on notepad. Sent a "1" for me.
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Mon Dec 01, 2008 7:07 am Post subject: |
|
|
| You sure the game doesn't use DirectInput?
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Dec 01, 2008 9:07 am Post subject: |
|
|
| noz3001 wrote: | | You sure the game doesn't use DirectInput? | That's what I'm guessing too.. I'm not very familiar with SDL input, I'll check out later when I've time.
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Mon Dec 01, 2008 1:27 pm Post subject: |
|
|
On Screen Keyboard (the one that ships with Win XP) uses SetWindowsHookEx.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Dec 01, 2008 2:43 pm Post subject: |
|
|
| nog_lorp wrote: | | On Screen Keyboard (the one that ships with Win XP) uses SetWindowsHookEx. | I wish it's source was available, darn MS.
Anyway.. Success! You need to use this keymap instead of VK_*: http://msdn.microsoft.com/en-us/library/ms835979.aspx .
So yea, noz3001, DirectInput ;) Oh yeh.. With SendInput.
|
|
| Back to top |
|
 |
|