1 2 3 | ::ReleaseCapture(); ::SendMessage(m_hWnd, WM_NCLBUTTONDOWN, HTCAPTION, NULL); ::SendMessage(m_hWnd, WM_LBUTTONUP, NULL, NULL); |
Day: December 16, 2019
win32响应WM_NCHITTEST消息后窗口未改变大小
对于popup style的窗体,要将其System Menu属性改为false,OnNcHitTest的返回正确值后,窗口才会改变大小。
win32限制改变窗口大小
响应WM_SIZING消息,消息函数中做如下处理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | void CDemoDlg::OnSizing(UINT fwSide, LPRECT pRect) { if (pRect->right - pRect->left < minWidth_) { if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_BOTTOMLEFT) { pRect->left = pRect->right - minWidth_; } else pRect->right = pRect->left + minWidth_; } if (pRect->bottom - pRect->top < memHdcHeight_) { if (fwSide == WMSZ_TOP || fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_TOPRIGHT) { pRect->top = pRect->bottom - minHeight_; } else pRect->bottom = pRect->top + minHeight_; } CDialogEx::OnSizing(fwSide, pRect); } |