Re: Get Window Title at Specific Coordinates
Posted: 12 May 2019, 13:00
sorry, i still dont understand how this is supposed to work. so we have the 8 byte(64 bit) struct POINT
which is being treated as an __int64 because "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.".
ok, suppose __int32 x = 0xXXXXXXXX; and __int32 y = 0xYYYYYYYY;, u have somewhere in memory 0xXXXXXXXX and right next to it 0xYYYYYYYY.
now, this 16 byte (64 bit) sequence of bytes in memory: .... XXXX XXXX YYYY YYYY .... is looked at and reinterpreted as the 64 bit integer: __int64 theArgument = 0xXXXXXXXXYYYYYYYY;.
that integer is then passed to WindowFromPoint and WindowFromPoint somehow knows that the high bytes are meant to be the X, whereas the low bytes represent the Y coordinate.
BUT! in the DllCall, if we're passing this number it has to be constructed the other way around: 0xYYYYYYYYXXXXXXXX, the high bytes are Y and the low - X.
???
also, presumably, these 64bit ints fit entirely into the 64bit RCX
the "rect by value" function is a nice find, gj
Code: Select all
struct POINT {
__int32 x;
__int32 y;
};
ok, suppose __int32 x = 0xXXXXXXXX; and __int32 y = 0xYYYYYYYY;, u have somewhere in memory 0xXXXXXXXX and right next to it 0xYYYYYYYY.
now, this 16 byte (64 bit) sequence of bytes in memory: .... XXXX XXXX YYYY YYYY .... is looked at and reinterpreted as the 64 bit integer: __int64 theArgument = 0xXXXXXXXXYYYYYYYY;.
that integer is then passed to WindowFromPoint and WindowFromPoint somehow knows that the high bytes are meant to be the X, whereas the low bytes represent the Y coordinate.
BUT! in the DllCall, if we're passing this number it has to be constructed the other way around: 0xYYYYYYYYXXXXXXXX, the high bytes are Y and the low - X.
???
also, presumably, these 64bit ints fit entirely into the 64bit RCX
the "rect by value" function is a nice find, gj