What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » VB Keypress help

VB Keypress help
Author: Message:
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. VB Keypress help
Ok I made a program that will double press W when the Up arrow was pressed once. I made it for a game. I tested it in Notepad and It works great. But when I go to use it in the game it does not work at all. Could any one explain to me why it don't work?

Heres my program:

code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyUp) Then
SendKeys "{W}"
SendKeys "{W}"
End If
End Sub
[Image: top.gif]
04-23-2006 11:10 PM
Profile PM Web Find Quote Report
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: VB Keypress help
Your game probably uses the DirectInput API.  That would be my default expectation for most modern 3D games.

http://msdn.microsoft.com/library/default.asp?url...nput/html/diov.asp

quote:
Apart from providing services for devices not supported by the Microsoft Win32 API, Microsoft DirectInput gives faster access to input data by communicating directly with the hardware drivers rather than relying on Microsoft Windows messages.
SendKeys() stuffs the Windows message loop, which sits at a higher level than DirectInput, so they are never seen by your game.

Unfortunately, I don't know off the top of my head how you would go about simulating keys so they are recognized by DirectInput. 
04-23-2006 11:53 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: VB Keypress help
http://allapi.net/apilist/keyb_event.shtml
04-24-2006 12:19 AM
Profile E-Mail PM Find Quote Report
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. RE: VB Keypress help
quote:
Originally posted by Adeptus
Your game probably uses the DirectInput API.  That would be my default expectation for most modern 3D games.

http://msdn.microsoft.com/library/default.asp?url...nput/html/diov.asp


SendKeys() stuffs the Windows message loop, which sits at a higher level than DirectInput, so they are never seen by your game.

Unfortunately, I don't know off the top of my head how you would go about simulating keys so they are recognized by DirectInput.

Humm ok. Well I found everything I need to know about DirectInput except how to send a keypress to a DirectX program (the game).

quote:
Originally posted by Matty
http://allapi.net/apilist/keyb_event.shtml

Humm but wouldn't that be the same as SendKeys() ? I don't see how that uses DirectInput in any way.

EDIT: I tryed that Matty and still no luck.

This post was edited on 04-24-2006 at 01:35 AM by DJeX.
[Image: top.gif]
04-24-2006 01:31 AM
Profile PM Web Find Quote Report
rav0
Veteran Member
*****

Avatar
i have an avatar

Posts: 1419
Reputation: 29
34 / Male / Flag
Joined: Aug 2003
RE: VB Keypress help
I don't thing that it's the same as SendKeys, just from looking. Try it :).

Since DirectInput is meant to be as fast as possible, and uses the device drivers, it might need to be done at a driver level. You could also try memory hacking DirectX. Both these options make it a lot more complicated though.

This post was edited on 04-24-2006 at 01:38 AM by rav0.
| [Image: dorsh] |

(\ /)
(O.o)
(> <)

This is Bunny. Copy Bunny into your signature to help him on his way to world domination
04-24-2006 01:36 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On