| View previous topic :: View next topic |
| Author |
Message |
Mal1t1a Cheater
Reputation: 0
Joined: 03 Jan 2010 Posts: 40
|
Posted: Thu May 19, 2011 2:18 pm Post subject: How can I press this key? |
|
|
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 |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu May 19, 2011 2:50 pm Post subject: |
|
|
| Why don't you use SendInput() |
|
| Back to top |
|
 |
Mal1t1a Cheater
Reputation: 0
Joined: 03 Jan 2010 Posts: 40
|
Posted: Thu May 19, 2011 3:40 pm Post subject: |
|
|
| 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 |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Thu May 19, 2011 4:25 pm Post subject: |
|
|
| PostMessage? |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu May 19, 2011 4:36 pm Post subject: |
|
|
| iPromise wrote: | | PostMessage? |
did you bother reading the first post.. at all.. ? |
|
| Back to top |
|
 |
Mal1t1a Cheater
Reputation: 0
Joined: 03 Jan 2010 Posts: 40
|
Posted: Thu May 19, 2011 4:37 pm Post subject: |
|
|
| 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 |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu May 19, 2011 4:45 pm Post subject: |
|
|
| don't use the process handle... try wm_keydown. also try to use spy++ to see what messages are being received |
|
| Back to top |
|
 |
Mal1t1a Cheater
Reputation: 0
Joined: 03 Jan 2010 Posts: 40
|
Posted: Thu May 19, 2011 5:31 pm Post subject: |
|
|
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 |
|
 |
Innovation Grandmaster Cheater
Reputation: 12
Joined: 14 Aug 2008 Posts: 617
|
Posted: Thu May 19, 2011 6:30 pm Post subject: |
|
|
| 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 |
|
 |
|