Click to See Complete Forum and Search --> : MFC Dialog: How to drag a dialog by grabbing any point?


Sonu Kapoor
February 13th, 2003, 02:54 PM
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:


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

return ret;
}

<br><br>