|
|
|
|
![]() ![]() |
Aug 14 2006, 07:16 AM
Post
#1
|
|
|
Advanced Member Group: Members Posts: 179 Joined: 14-August 06 From: Vault 0 / Brazil Member No.: 15,193 |
I'm trying to simulate a key press in an external program (actually a game).
Using the keybd_event does work for regular Windows programs (like Notepad, for example), but not for the game. I suppose this happens because it uses DirectX libraries, and also this simulation provided by keybd_event isn't, let's say, low-level enough. Would someone be able to help me on this? I'm using currently Delphi (Pascal), but if needed I suppose I can manage to apply some assembly code or something. Thanks in advance. |
|
|
|
Sep 27 2006, 12:01 PM
Post
#2
|
|
|
Teh Coder Group: Members Posts: 1,053 Joined: 18-April 06 From: Australia Member No.: 12,833 |
Looks like I missed this one....
I have done this for Age Of Empires 2, to automatically enter cheats very fast to get resources up alot quicker (for my younger brother) in Delphi 7. Not sure why you are having problems with keybd_event, but don't forget about SendMessage and PostMessage API's. Which is most likely how I managed to get it done. Unfortunately the old Age Of Empires 2 project is long gone with an old crash of my older pc which I lost alot of good old Delphi projects (should have backed em up eh). |
|
|
|
Sep 27 2006, 01:20 PM
Post
#3
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 2,042 Joined: 16-August 05 Member No.: 7,896 |
huh ? did you really post here in order to explain that you had the solution of the problem and you don't have it any more so no more need for posting an answer ?
|
|
|
|
Sep 27 2006, 01:25 PM
Post
#4
|
|
|
Teh Coder Group: Members Posts: 1,053 Joined: 18-April 06 From: Australia Member No.: 12,833 |
Not at all, I provided two alternatives to sending key presses which are the SendMessage and PostMessage API's.
They are both fairly much the same except that SendMessage will wait until it's done where as PostMessage will just send it and come back not worrying about whether it got to it's location or not. |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 11th October 2008 - 06:09 PM |