DllCall() how to pass a structure? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Avtem
Posts: 43
Joined: 01 Jun 2021, 02:20

DllCall() how to pass a structure?

Post by Avtem » 19 Jun 2021, 23:42

So, there is a WinAPI function

Code: Select all

HWND WindowFromPoint(POINT Point)
and the only parameter is of type POINT. It's NOT LPOINT, LPPOINT or POINT*. Of course i can't use "ptr" and pass a pointer in DllCall() because this is an entirely different signature and this won't work.
Is it possible to call such functions in AHK? Because you have to specify parameter types in DllCall(), right?
User avatar
Avtem
Posts: 43
Joined: 01 Jun 2021, 02:20

Re: DllCall() how to pass a structure?

Post by Avtem » 21 Jun 2021, 00:07

Thank you so much. The first answer in that topic yielded the expected result. i will learn about that a bit and then accept your answer!
User avatar
Avtem
Posts: 43
Joined: 01 Jun 2021, 02:20

Re: DllCall() how to pass a structure?

Post by Avtem » 22 Jun 2021, 04:36

So, the solution is to pass a structure as a set of integers that are same size.
From MSDN (link):
Structs and unions of size 8, 16, 32, or 64 bits, and __m64 types, are passed as if they were integers of the same size. Structs or unions of other sizes are passed as a pointer to memory allocated by the caller.
Post Reply

Return to “Ask for Help (v1)”