Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


PostMessage

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sun Nov 30, 2008 5:04 pm    Post subject: PostMessage Reply with quote

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
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Sun Nov 30, 2008 5:13 pm    Post subject: Re: PostMessage Reply with quote

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
View user's profile Send private message Send e-mail
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Mon Dec 01, 2008 4:14 am    Post subject: Re: PostMessage Reply with quote

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
View user's profile Send private message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Mon Dec 01, 2008 6:31 am    Post subject: Reply with quote

I tried this code on notepad. Sent a "1" for me.
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Mon Dec 01, 2008 7:07 am    Post subject: Reply with quote

You sure the game doesn't use DirectInput?
Back to top
View user's profile Send private message MSN Messenger
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Mon Dec 01, 2008 9:07 am    Post subject: Reply with quote

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
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Mon Dec 01, 2008 1:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Mon Dec 01, 2008 2:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites