IN VC++
ClientToScreen(&CPoint);
ClientToScreen(&CRect);
but
in bc++
ClientToScreen(&CPoint);
is it true?
while using
ClientToScreen(&CPoint);
it goes out of window.How to use it?
Printable View
IN VC++
ClientToScreen(&CPoint);
ClientToScreen(&CRect);
but
in bc++
ClientToScreen(&CPoint);
is it true?
while using
ClientToScreen(&CPoint);
it goes out of window.How to use it?
ClientToScreen is a WinAPI function wrapped up by MFC's CWnd and probably by VCL's TWnd (or whatever) too.
The original version is passed a POINT *, I guess TPoint is derived from POINT just like CPoint, so TPoint * should work.
What do you mean it goes out of the screen?
if the initial position of window starts in (0,0) of desktop screen
then while clipcursor(&rect) mouse draggs within the windows if it displaces again the mouse graggs from (0,0) of the desktop to length of window.
so how to convert the coordinates?
Can you rephrase that? I don't understand.
Rect=GetClientRect();
ClientToScreen(TPoint(Rect.left,Rect.top));
SetCapture();
ClipCursor(&Rect);
Above are the codes I have written.
when I run my program.if my window's top-left angle is conside with top-left of desktop that is Point(0,0) then it works ok but if not conside when I drag my mouse over my window it draw correctly on mywindow but the cursor goes out of my window.
The mouse pointer should be insided my window even if I tried to move out of my window.
TPoint(rect.left, rect.top)
creates a copy of those coordinates. It won't alter the original rect.
Actually I am surprised this is allowed at all. Logically the prototype of the function has to be
void TWnd::ClientToScreen(TPoint & pt);
but then you shouldn't be able to pass a TPoint object created on the fly to it. The only explanation I see is that the Borland compiler is worse than I thought.
Do you have bc++5.I will put all my codes here so that you check it?
Thanks
I don't.