How can I make a dialog NOMOVE? When you drag mouse on titlebar, the dialog do not move.
Printable View
How can I make a dialog NOMOVE? When you drag mouse on titlebar, the dialog do not move.
If its a dialog you created through the resource editor, in its create function (or similar) try something like:
SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
or, just get rid of the title bar and use something else in its stead
PHP Code:UINT CYOURDialog::OnNcHitTest(CPoint point)
{
UINT ret = CDialog::OnNcHitTest(point);
if(HTCAPTION == ret)
return HTCLIENT;
return ret;
}
What I know about it you can remove the caption - that's the window style you can remove it using ModifyStyle function. Or if you like the caption :) you can play with WM_SIZE or better with WM_WINDOWPOSCHANGED, WM_WINDOWPOSCHANGING. You can add:
BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
//{{AFX_MSG_MAP(CTestDlg)
ON_WM_WINDOWPOSCHANGED()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
and so on. You can find this macros(ON_WM_WINDOWPOSCHANGED) in MSDN to take the message handler prototype from there, something like afx_msg LRESULT OnWindowPosChanged(LPWINDOWPOSSTRUCT ... - sorry, I never remember such things and always copy them from MSDN topics.
I have already posted the simplest way to do it.
Thank you all.