MFC Dialog: How to drag a dialog by grabbing any point?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: MFC Dialog: How to drag a dialog by grabbing any point?

Hybrid View

  1. #1
    Join Date
    Dec 2001
    Location
    Canada/Montreal
    Posts
    983

    MFC Dialog: How to drag a dialog by grabbing any point?

    Q: How to drag a dialog by grabbing any point?

    A: Go to the dialog class in your class view and choose "Add Windows message handler". Set the "Filter for messages available to class" dropdown to "Window". Select the 'WM_NCHITTEST' message and press "Add and Edit". Code the message handler like this:

    Code:
    UINT CYourDialog::OnNcHitTest(CPoint point) 
    {   
      UINT ret = CDialog::OnNcHitTest(point);
      if(ret == HTCLIENT)
        return HTCAPTION;
    
      return ret;
    }

    Last edited by Andreas Masur; July 24th, 2005 at 05:27 PM.

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

This is a CodeGuru survey question.


Featured


HTML5 Development Center