Dragging a dialog by clicking anywhere on it
Posted
by Craig Lucas
on August 7th, 1998
void CNCHitDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
CDialog::OnLButtonDown(nFlags, point);
// fake windows into thinking your clicking on the caption, does not
// maximize on double click
PostMessage( WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM( point.x, point.y));
}
or
UINT CNCHitDlg::OnNcHitTest(CPoint point)
{
UINT nHitTest = CDialog::OnNcHitTest( point );
// also fake windows out, but this maximizes the window when you double
// click on it.
return (nHitTest == HTCLIENT) ? HTCAPTION : nHitTest;
}

Comments
it works excellent except clicked on menu area!
Posted by showhigh on 01/06/2006 07:13amhow to solve it?
ReplyElegant Simplicity!
Posted by jgazin on 05/21/2004 06:41pmHow to drag a dialog playing movie on it.?
Posted by Legacy on 08/21/2003 12:00amOriginally posted by: Nick
Hi there.,
How to drag a dialog playing movie on it (on a picture control) by grabbing anywhere .?
Thanks .!
Best Regards,
ReplyNick.
Win32 only ? (no class, no MFC) Click here...
Posted by Legacy on 06/11/2003 12:00amOriginally posted by: maya75
Reply
great
Posted by Legacy on 04/03/2003 12:00amOriginally posted by: beinerror
thank you very much for this!!
Reply
How can I do that with CFrameWnd
Posted by Legacy on 02/02/2002 12:00amOriginally posted by: Gandalf
How can I do the same thing but catching the view in application with CFrameWnd as main window. When I try to use both methods you've mentioned I can only move the view inside the frame, not the frame.
ReplyDOESNT WORK AT ALL!!!
Posted by Legacy on 12/13/2001 12:00amOriginally posted by: Boogly POO
I tried both methods and no luck for me. I even tried again by starting a brand new mfc dialog app with nothing in the dialog box, and it still didnt work.
HELP!!!
ReplyBut it cannot work in WinCE!
Posted by Legacy on 12/10/2001 12:00amOriginally posted by: jiajia
But it cannot work in WinCE.
MFC for Windows CE does not support the following method of the CWnd class:
OnNcHitTest
ReplyMoving dialog with button
Posted by Legacy on 12/07/2001 12:00amOriginally posted by: Neal
Reply
Another solution for ATL
Posted by Legacy on 11/01/2001 12:00amOriginally posted by: Nikolay Yankov
ReplyLoading, Please Wait ...