Seeing a simple method implementation from Microsoft sites, do not have to calculate RECT, you don't have to deal with the details of the mouse message and window drawing, you can easily implement the window movement of the title bar, which is to use the onnchittest message.
Handmade this message mapping: Use classwizard that cannot add this message, add message on_wm_nchittest () in begin_MESSAGE_MAP, and add AFX_MSG uint onnchittest (cpoint point) in the header file;
Add LButtondown message functions in implementation files
void CClyzDlg :: OnLButtonDown (UINT nFlags, CPoint point) {CTranDialog :: OnLButtonDown (nFlags, point); // put into your base class CTranDialog PostMessage (WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM (point.x, point.y)) }
Join NChitTest message functions
Uint cclyzdlg :: Onnchittest (cpoint point) {uint nhittest = ctrandialog :: OnnithTest (Point); // Change CTRANDIALOG to your base class Return (nhittest == htclient)? Htcaption: nhittest;
Compile operation, there is no error, it is not completed, and the ten row code is not before and after.
I use the dialog-based application, compiled in VC6.0, WinNT4.0, and run well.