Results 1 to 8 of 8

Thread: ClientToScreen(&CPoint);

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    163

    ClientToScreen(&CPoint);

    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?
    Purushottam

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    163
    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?
    Purushottam

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Can you rephrase that? I don't understand.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    163
    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.
    Purushottam

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    163
    Do you have bc++5.I will put all my codes here so that you check it?
    Thanks
    Purushottam

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I don't.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width