Jump to content

DLLCall with Structures


cppman
 Share

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?

Link to comment
Share on other sites

Well, if it's not a ptr, then try to pass the point coordinates directly:

$hWnd = DLLCall("user32.dll", "hwnd", "WindowFromPoint", "long", $x, "long", $y)

Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

O RLY?

$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"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...