dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: VC++6.0. How show a modal dialog near at the cursor?

  1. #1
    Join Date
    Dec 2003
    Posts
    72

    Question VC++6.0. How show a modal dialog near at the cursor?

    Hello,

    I must show a modal dialog near at the cursor. How I can use coordinate
    from
    OnRButtonDown(UINT nFlags, CPoint point)
    for to position the dialog?

    When I use point in

    SetWindowPos(NULL, point.x, point.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

    the position is incorrect. Someone can help me?

    Thanks


  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,555

    Re: VC++6.0. How show a modal dialog near at the cursor?

    You're probably getting screen and client coordinates mixed up. There's not enough context provided to say much more than that.

  3. #3
    Join Date
    Feb 2002
    Posts
    3,788

    Re: VC++6.0. How show a modal dialog near at the cursor?

    Code:
    OnRButtonDown(UINT nFlags, CPoint point)
    
    ClientToScreen(&point);
    
    SetWindowPos(NULL,  point.x,  point.y,  0,  0, SWP_NOSIZE | SWP_NOZORDER);

  4. #4
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: VC++6.0. How show a modal dialog near at the cursor?

    Why not MoveWindow?

    (Yes, followed by ClientToScreen conversation!)
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  5. #5
    Join Date
    Dec 2003
    Posts
    72

    Re: VC++6.0. How show a modal dialog near at the cursor?

    I think to have find solution:

    CWnd* pWndC = AfxGetMainWnd();

    CRect rectC;
    pWndC->GetWindowRect(&rectC);

    SetWindowPos(NULL, point.x, (rectC.bottom-point.y), 0, 0, SWP_NOSIZE | SWP_NOZORDER);

    Where point I get from:
    OnRButtonDown(UINT nFlags, CPoint point)
    In this mode the dialog is near at the cursor.

    Thanks at all


Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)