01-02-2005, 03:20 AM
Has anyone had any luck getting GetAsyncKeyState from user32 to function in fb? For some reason I am only getting nulls, even when I have a key down.
Would GetAsyncKeyState(key) AND &H8000 be the same as
Vb's CBool(GetAsyncKeyState(key) AND &H8000)?
Written as source in VB it works great, but I was hoping to have FB compile it to a dll, and then call it from my FB/VB hybrid project. Any ideas??
Also in my experimentations on trying to get this to work in FB, I've also found that making a dll with Inkey$ or GetChar (as a substitute) causes VB to crash. Why would this be the case?
Code:
function keyb ( ) as string
dim Key as Long, Wait as Integer
For Key = 1 to 255
if GetAsyncKeyState(Key) AND &H8000 <> 0 Then keyb = keyb + chr$(key)
Next key
Wait = Wait AND Len(keyb)
Do While Wait = 0
Wait = 0
For Key = 1 to 255
If GetAsyncKeyState(Key) AND &H8000 <> 0 Then Wait = 1
Next key
Loop
end function
Would GetAsyncKeyState(key) AND &H8000 be the same as
Vb's CBool(GetAsyncKeyState(key) AND &H8000)?
Written as source in VB it works great, but I was hoping to have FB compile it to a dll, and then call it from my FB/VB hybrid project. Any ideas??
Also in my experimentations on trying to get this to work in FB, I've also found that making a dll with Inkey$ or GetChar (as a substitute) causes VB to crash. Why would this be the case?