greenmachine Posted January 22, 2006 Share Posted January 22, 2006 I was reading through some scripts on here, and there's dealing with hotkeys that got my attention. Someone asked whether you could make a function to get key presses and make a hotkey out of that. I looked up some DllCall stuff, and found GetKeyboardState. I want to try this function to see if it does anything I want it to, but I can't figure out how to use the DllCall. The GetKeyboardState function copies the status of the 256 virtual keys to the specified buffer. Syntax BOOL GetKeyboardState( PBYTE lpKeyState );Parameters lpKeyState [in] Pointer to the 256-byte array that receives the status data for each virtual key. I get this far: Global $KeyboardState[257] ; one extra just in case $returnvalue = DllCall ("user32.dll", "int", "GetKeyboardState", "_____", $KeyboardState) MsgBox (0, "return", $returnvalue & @CRLF & @error) No matter what it put in the ___ part (where it should be pbyte according to MSDN), I get a return value of 0 and @error is 2. So... anyone know what the equivalent of Pbyte is in AutoIt? Or, another function that I could use instead of this? Link to comment Share on other sites More sharing options...
w0uter Posted January 22, 2006 Share Posted January 22, 2006 try dllstructcreate to create an array of bytes and then use dllstructgetptr for the call Pbyte = Pointer to a Byte My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
greenmachine Posted January 22, 2006 Author Share Posted January 22, 2006 Good idea. Now to learn how to do that. Link to comment Share on other sites More sharing options...
greenmachine Posted January 22, 2006 Author Share Posted January 22, 2006 I don't think I'm getting it. I made a struct: $struct = DllStructCreate ("byte[257]") Then do I call it like this? $returnvalue = DllCall ("user32.dll", "int", "GetKeyboardState", "ptr", DllStructGetPtr ($struct)) I need help on the call part.. what should I use instead of ptr (since it doesn't seem to work), or am I doing something else wrong? Link to comment Share on other sites More sharing options...
Oxin8 Posted January 22, 2006 Share Posted January 22, 2006 not sure if all the numbers are perfect but it definately works $struct = DllStructCreate ("byte[256]") $returnvalue = DllCall ("user32.dll", "int", "GetKeyboardState", "ptr", DllStructGetPtr ($struct)) $temp = DLLStructGetData($struct,1,1) $message = DLLStructGetData($struct,1,1) For $i = 2 to 256 message = $message & @CRLF & DLLStructGetData($struct,1,$i) Next Msgbox(0,"Keys",$message) sorry it doesn't look any prettier.... lol ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
greenmachine Posted January 22, 2006 Author Share Posted January 22, 2006 Eh, I was almost getting there. Thanks for the help. Link to comment Share on other sites More sharing options...
Oxin8 Posted January 22, 2006 Share Posted January 22, 2006 anytime. plus i had to take a break from trying to get the raw input api's working in vb. if it's this much fun in vb just wait until i have to convert it to autoit... ugh ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
greenmachine Posted January 22, 2006 Author Share Posted January 22, 2006 VB isn't being nice to me. I evidently don't have the right tools to work with normal VB programs, so the Winsock script I downloaded can't be edited and re-run.. because I don't have a compiler.... Something like that. I don't even know. I just haven't had any luck with file transfer with tcp. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now