May 08, 2024, 01:55:45 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


ScreentoClient

Started by Haim, March 10, 2006, 12:09:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Haim

Hello,
I need to convert screen mouse coordinates to client coordinates.
I think this should be done with ScreentoClient, but I do not know how to refer to write the window argument.
Could anyone show me an example of Screentoclient?
Thanks for your help.


Mike Stefanik

March 10, 2006, 12:45:53 AM #1 Last Edit: March 10, 2006, 01:21:08 AM by Mike Stefanik
You'd declare it like this:


declare import,ScreenToClient(unsigned int hWnd, POINT *lppt), int;


In your code, you'd use the m_hWnd member of the CWindow derived class, doing something like:


POINT pt;
int bConverted;

// initialize the POINT struct to the coordinates you're interested in
// and then call ScreenToClient to convert it to client coordinates
bConverted = ScreenToClient(m_hWnd, &pt);
if (bConverted)
{
ÂÃ,  ÂÃ,  // do something with the converted coordinates
}


Edit: Spelling is not my strong suit :)
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

Haim

Thanks!
Exactly what I needed.

lviklund

Thank's Mike
I needed that info as well.

/Lasse