Page 1 of 1

Why not standard ChildWindowFromPoint syntax?

Posted: Tue Dec 30, 2003 1:01 pm
by storck
This is not a very big deal, but I can't help asking:

Is there a good reason for the ChildWindowFromPoint NOT using the syntax described in MSDN or api help files?

HWND ChildWindowFromPoint(HWND hWndParent, POINT Point);

I wasted quite some hours only to find out that the PB version wanted
ChildWindowFromPoint_ (window, x, y)

I thought I was supposed to be able to use all api calls without keeping track of some calls using a non standard syntax.

It could be that I am just plain stupid, but is there a reason for the syntax differences? Any plans to fix it? Or am I just mistaken?

/Storck

Posted: Tue Dec 30, 2003 1:36 pm
by Pupil
It's because purebasic only support passing the pointer to a structured variable and not the individual values inside the structure (as is needed in this case) to a procedure or API function.

Posted: Tue Dec 30, 2003 9:29 pm
by Hi-Toro
I got caught by this too. Is this (along with WindowFromPoint) the only case where this occurs? I would never have figured it out if someone else hadn't shown me the 'solution'. I'd swear you can do stuff like this elsewhere in the API though, that is, BlahBlah (@whatever.Example)...?

Posted: Tue Dec 30, 2003 11:23 pm
by Froggerprogger
The MSDN says POINT to be requested, and with it all the seperated values itself.
Many other functions do use a pointer to a struct, such as GetCursorPos_(). The parameter is indicated as LPPOINT then, the LP* stands for 'long pointer' I think.

So just read the MSDN carefully if it is a pointer or not.

(anyway - the MSDN is really misunderstandable in this point)

Happy new year!

Posted: Fri Jan 02, 2004 6:32 pm
by storck
Thank you all! I knew there was something I didn't quite get... It has happened before and I am afraid it will happen again some time soon. :wink:

Regards,

Storck

Posted: Fri Jan 02, 2004 11:54 pm
by tinman
Perhaps that's something Fred could add to PB - the ability to pass a structured variable to procedures and it passes a copy of the entire structure (like the API in this case and C).

It would also be pretty neat if you could pass pointers and mark them as read only within the procedure.
[/b]