Sign in to follow this  
Followers 0
PartyPooper

Need help with DllCall using user32.dll

4 posts in this topic

I'm trying to learn more about DllCall and thought I'd start with something simple like getting the current cursor position (in screen coordinates) but since I know nothing of user32.dll (only what I've seen others do with it), I'm shooting in the dark. For now, I'll keep it simple and just work with user32.dll until I know more about functions and structures of DLL's. Can someone tell me how where I can find out about the functions of user32.dll and how I determine what to put on the DllCall line (it's structure I guess)?

This is what I have so far (it's only a guess at how the function may look like). I was hoping it would tell me the current X & Y of the cursor but as I don't know the structure of user32.dll, I can't go any further.

Func _CursorPos()
    Local $POINT = DllStructCreate("long;long")
    Local $X, $Y
    DllStructSetData($POINT, 1, $X)
    DllStructSetData($POINT, 1, $Y)
    Local $ret = DllCall("user32.dll", "int", "GetCursorPos", "ptr", DllStructGetPtr($POINT))
    MsgBox(0,'',($ret[0]/65535), ($ret[1]/65535))
EndFunc

Share this post


Link to post
Share on other sites



Thanks for correcting the function Larry (I was close - a good guess), however, I'm still no wiser as to the functions and structures of user32.dll (or any other dll for that matter) which is really what I would like to learn. So can anyone point me in the direction of said info.

Thanks

Share this post


Link to post
Share on other sites

msdn.microsoft.com

Search under the name of the function you want to call.

To get a list of functions, I use DllExp (not sure where I got it though).

Share this post


Link to post
Share on other sites

Thanks greenmachine. I Googled DllExp and got a copy so hopefully this will shed some light on the matter.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0