EnableExplicit
Define i, pt.Point
Repeat
GetCursorPos_(@pt)
Debug WindowFromPoint_(@pt)
Delay(1000)
i+1
Until i = 10
Yesterday i played with WindowFromPoint_(), ChildWindowFromPoint_(),
ChildWindowFromPointEx_(), RealChildWindowFromPoint_() ... but never get
a hWnd back. Always 0. Nothing works. What is wrong?
Last edited by Danilo on Tue Dec 06, 2011 12:01 pm, edited 1 time in total.
Thank you, MachineCode. This is changed for all POINT structures? Use PeekQ?
Looks very silly. In C you can give a POINT directly for some functions, i remember this.
But using PeekQ now is weird.
Who changed it to use PeekQ? Fred or freak?
Last edited by Danilo on Tue Dec 06, 2011 11:47 am, edited 1 time in total.
srod wrote:Careful with WindowFromPoint_() as it's internal prototype has now changed between PB 4.3 beta 2 and beta 3. This means that between PB 4.2 and 4.3 (the latest beta) WindowFromPoint_() has gone from accepting two parameters of type long to one of type quad.
Point
[in] Specifies a POINT structure that defines the point to be checked.
This was changed some time back to conform with Microsoft's specification. The API expects the full point structure as input, not a pointer to it and not two parameters x,y. Purebasic in the past had been taking (x,y) for simplicity and converting under the hood but they've stopped doing that now. I say simplicity but in reality it was probably necessity as this API was first imported before Purebasic had native quads. The change has caused some confusion, to be sure, but now that quads are available it was the right thing to do.
Danilo wrote:The QuickHelp in the statusbar shows "WindowFromPoint_(POINT)". PB can not handle this,
so it should show "WindowFromPoint_(point.q)" in my opinion.
I agree, the doc isn't correct and your suggestion would make it clearer. I can see a reason why the API designers would need a parameter to be passed by reference in a lot of cases but I can't see a reason to force passing by value when a structure is involved, just because its size happens to fit in an intrinsic data type. They could have worked with the pointer just as well for conformity with the vast majority of other API calls which use pointers to structures. I remember the first time I used the AlphaBlend API I tussled with it for over an hour before I realized they wanted the BLENDFUNCTION structure passed by value where I was trying to pass its address. As if we don't have enough headaches trying to get things to work