Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag window 1

Status
Not open for further replies.

scienzia

Programmer
Feb 21, 2002
160
IT
Hi,

does anybody know how to make the window be dragged when I click and keep the left mouse button down on any place of the window that is not a button or a textbox (the behaviour of most skinned apps)?

thanks in advance
 
I cant remember the code exactly but on theory:
when your window receives WM_MOUSEMOVE message, then you should check if the left buttons is down (wParam) and if it is then you should calculate coords and send a WM_MOVE message to the window SendMessage() ...

 
Look on and they have a demo project "form shaper" it has this code:

Code:
case WM_LBUTTONDOWN:
			SendMessage(hWnd,WM_NCLBUTTONDOWN,HTCAPTION,0);	//this is to move the form
 
Thankyou very much.

In MFC:

Code:
void CMyDlg::OnLButtonDown(UINT nFlags, CPoint point) 
{
	SendMessage(WM_NCLBUTTONDOWN,HTCAPTION);	
	CDialog::OnLButtonDown(nFlags, point);
}
[\code]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top