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 


help sending keys...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
kot1990
Expert Cheater
Reputation: 1

Joined: 06 Sep 2009
Posts: 131
Location: Greece

PostPosted: Mon Apr 19, 2010 7:11 am    Post subject: help sending keys... Reply with quote

I want to send keys to a specified window in C++. I tried sendinput, it works, but it doesn't send the key to a specified window. I also tried PostMessage() as follows to send the key '4'

Code:

PostMessage(Win, WM_KEYDOWN, 0, 0x50001);
PostMessage(Win, WM_KEYUP, 0, 0x50001);


I put it in a loop but it sends the key only if I press some key on the keyboard, it won't work automatically Sad

EDIT: I also tried with wParam

Code:

PostMessage(Win, WM_KEYDOWN, 0x34, 0);
PostMessage(Win, WM_KEYUP, 0x34, 0);


and also tried to put them both wParam and lParam but nothing worked.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Apr 19, 2010 8:40 am    Post subject: Reply with quote

Is the window you are trying to send to a game window or your own ?
Back to top
View user's profile Send private message
kot1990
Expert Cheater
Reputation: 1

Joined: 06 Sep 2009
Posts: 131
Location: Greece

PostPosted: Mon Apr 19, 2010 8:43 am    Post subject: Reply with quote

It's a game window, but my app is injected in it, so it's the same process. I also tried keybd_event() but it sends keystrokes to everything is active, not only the game.

EDIT: I log in the game, inject my dll, and then it should press repeatedly the key '4'. It does nothing,, but if I press a random key on the keyboard,, then the key '4' is pressed (the game window has to be active). It happens only when I press a key on the keyboard. The same is not happening when I click somewhere.

EDIT2: I'm pretty sure that the game has a check before processing the WM_KEYDOWN & WM_KEYUP messages. I think its something like

Code:

switch(msg)
{
         case: WM_KEYDOWN
                if(whatIamLookingFor)
                {
                      process message;
                }
         case: WM_KEYUP
                if(whatIamLookingFor)
                {
                      process message;
                }
}


I want to create a keyPresser than to send packets for skills,, because the skills are to many and its hard to get only the skills that the player has, because this data is transmitted by the server when the char logs in, and the packet has so many data in,, I can't analyze the whole structure of the packet. It has dozens of variables and its very hard.
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