2013-12-12实现窗口的拖动

void CPcLoginDlg::OnLButtonDown(WPARAM wParam, LPARAM lParam)
{
POINT pt = {0};
pt.x = LOWORD(lParam); 
pt.y = HIWORD(lParam);
RECT rcClient = {0};
GetClientRect(m_hWnd, &rcClient);


if((pt.x >= 0) && (pt.x < rcClient.right - rcClient.left))
{
SendMessage(m_hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
}


}

当鼠标左键点击到窗口区域的时候,可以实现窗口拖动。

你可能感兴趣的:(2013-12-12实现窗口的拖动)