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 


How can I press this key?

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

Joined: 03 Jan 2010
Posts: 40

PostPosted: Thu May 19, 2011 2:18 pm    Post subject: How can I press this key? Reply with quote

All I need, is to make the game think that I pressed the "Enter" key. However, I can't get the proper handle. I believe the game is using direct-x. But I can't be sure.

I've gotten the window handle, and used PostMessage, and SendMessage (both tested with notepad and other applications), but does not work on games. I've been reading alot about this, searching everywhere, and it seems that you can't do it unless you hook the DirectInput hook or something of the sort. Now, I'm not able to do that, as I have no knowledge in C++.

I've come across this: http://www.gamedev.net/topic/371104-c-directinput-hooking-component-and-sample/

Would that work? If so, is there a way I could use it with VB.NET? (I know, bad language). I just want to simulate the press of the "enter" button.

Oh and just so you know, I want to do this, while having the game minimized. Can someone help me? All I want to do is press the "enter" key (13) in-game, while the game is minimized.

The game is Ace of Spades, so you know.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu May 19, 2011 2:50 pm    Post subject: Reply with quote

Why don't you use SendInput()
Back to top
View user's profile Send private message
Mal1t1a
Cheater
Reputation: 0

Joined: 03 Jan 2010
Posts: 40

PostPosted: Thu May 19, 2011 3:40 pm    Post subject: Reply with quote

SendInput only works when the game has focus. I.e. when it's maximized. I want to do it in the background, when it doesn't have focus. When it's minimized.
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Thu May 19, 2011 4:25 pm    Post subject: Reply with quote

PostMessage?
Back to top
View user's profile Send private message MSN Messenger
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu May 19, 2011 4:36 pm    Post subject: Reply with quote

iPromise wrote:
PostMessage?

did you bother reading the first post.. at all.. ?
Back to top
View user's profile Send private message
Mal1t1a
Cheater
Reputation: 0

Joined: 03 Jan 2010
Posts: 40

PostPosted: Thu May 19, 2011 4:37 pm    Post subject: Reply with quote

I tried sendmessage and postmessage with the process handle, and with the window handle. both didn't work. I was using WM_CHAR. It works for a program like notepad, or cmd.exe but not for a fullscreen game.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu May 19, 2011 4:45 pm    Post subject: Reply with quote

don't use the process handle... try wm_keydown. also try to use spy++ to see what messages are being received
Back to top
View user's profile Send private message
Mal1t1a
Cheater
Reputation: 0

Joined: 03 Jan 2010
Posts: 40

PostPosted: Thu May 19, 2011 5:31 pm    Post subject: Reply with quote

yeah after various testing, I have learned that the process handle is not to be used. I'll test with wm_keydown, however, I'm pretty sure I've tried it already and nothing happened.

Edit:
Okay, well, I guess when I tried WM_KEYDOWN it was when I tried using the process handle. As now it does work. Using SPY++ the game takes WM_KEYDOWN, WM_CHAR, then WM_KEYUP. As a keystroke.
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Thu May 19, 2011 6:30 pm    Post subject: Reply with quote

Mal1t1a wrote:
yeah after various testing, I have learned that the process handle is not to be used. I'll test with wm_keydown, however, I'm pretty sure I've tried it already and nothing happened.

Edit:
Okay, well, I guess when I tried WM_KEYDOWN it was when I tried using the process handle. As now it does work. Using SPY++ the game takes WM_KEYDOWN, WM_CHAR, then WM_KEYUP. As a keystroke.

In the future, please query MSDN when unsure about parameters.

PostMessage Function
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