Jump to content
Sign in to follow this  

DLLCall with Structures

Recommended Posts

Hi everyone. I have been curious for a while now, how would it be possible for me to call a dll function that does not take a pointer to a structure? For example, I am trying to call the WindowFromPoint function. However it's prototype is like this.

HWND WindowFromPoint(POINT Point);

As you can see it isn't LPPOINT so setting the type to "ptr" is out of the question..

So far I can make this out to be:

$hWnd = DLLCall("user32.dll", "hWnd", "WindowFromPoint", "what goes here?", "the structure goes here")

Any ideas?

Share this post

Link to post
Share on other sites


$x = 10
$y = 10
Run("notepad.exe", "", @SW_MAXIMIZE)
WinWaitActive("Untitled - Notepad")
$hwnd1 = WinGetHandle("Untitled - Notepad")
$ret = DLLCall("user32.dll", "hwnd", "WindowFromPoint", "long", $x, "long", $y)
$hwnd2 = $ret[0]
MsgBox(0, '', $hwnd1 & @CRLF & $hwnd2)
WinClose("Untitled - Notepad")
Edited by Siao

"be smart, drink your wine"

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  

  • Create New...