|
-
Aug 10th, 2000, 02:28 AM
#1
Thread Starter
Member
My application never has the focus but I needed to assign hotkey functions.
While playing in a Direct-X Game I need my app to catch my 4 different hotkeys being pressed and to perform a function.
I tried the System Wide Hotkey API stuff but thats no good for Dx games, so I got the Direct X Method of assigning keys to functions but it won't work either.
I've tried this code outside of the game with MsgBoxs and it works great, but when I try in the game it doesn't......
I know people make game cheats that use hotkeys, this works the same way but this is a message program not a cheat.
Please Help me, Heres my code:
In the Form:
Dim dx7 As New DirectX7
Dim state As DIKEYBOARDSTATE
Dim iKey As Integer
Dim dinput As DirectInput
Dim keys(255) As String
Dim dev As DirectInputDevice
Private Sub Form_Load()
tmrKey.Interval = 50
Set dinput = dx7.DirectInputCreate()
Set dev = dinput.CreateDevice("GUID_SysKeyboard")
dev.SetCommonDataFormat DIFORMAT_KEYBOARD
dev.Acquire
End Sub
Private Sub tmrKey_Timer()
dev.GetDeviceStateKeyboard state
For iKey = 0 To 255
If state.Key(iKey) <> 0 Then
End If
Next
If state.Key(67) <> 0 Then mtdpxf.Display -1, (Actions.F9Value.text)
If state.Key(68) <> 0 Then mtdpxf.Display -1, (Actions.F10Value.text)
If state.Key(87) <> 0 Then mtdpxf.Display -1, (Actions.F11Value.text)
If state.Key(88) <> 0 Then mtdpxf.Display -1, (Actions.F12Value.text)
DoEvents
End Sub
Vince McMullin
Aka Vam, Vinny Mac
Its just that simple
-
Aug 10th, 2000, 10:02 AM
#2
Thread Starter
Member
Another day and yet no one knows, I'm hoping Kedaman or Megatron or Aaron Young might know how to make this work.....
Please help
Vince McMullin
Aka Vam, Vinny Mac
Its just that simple
-
Aug 10th, 2000, 02:37 PM
#3
transcendental analytic
GetAsyncKeyState API is the answer (sorry for being away)
Code:
'In declarations
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
'For instance having ESC to end your app:
If GetAsyncKeyState(vbKeyEscape) Then Unload me
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|