Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Keyboard Simulation, Low-level / Pascal / Delphi / Keyboard input simulation
KDEWolf
post Aug 14 2006, 07:16 AM
Post #1


Advanced Member
Group Icon

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.
Go to the top of the page
 
+Quote Post
Chesso
post Sep 27 2006, 12:01 PM
Post #2


Teh Coder
Group Icon

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).
Go to the top of the page
 
+Quote Post
yordan
post Sep 27 2006, 01:20 PM
Post #3


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 2,043
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 ? biggrin.gif
Go to the top of the page
 
+Quote Post
Chesso
post Sep 27 2006, 01:25 PM
Post #4


Teh Coder
Group Icon

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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Resources For Beginner Delphi Programmer ?(11)
  2. Uploading File Using Delphi To A Php Upload Script(4)
  3. Help: Change Language On Fly With Delphi(3)
  4. Can Delphi Be Used For Distributed Appz?(1)
  5. Delphi 6 And XP(2)
  6. Hide Delphi's Splash Screen - Delphi 6(0)


 



- Lo-Fi Version Time is now: 13th October 2008 - 08:27 AM