LRESULT CbarDlg: OnNcHitTest (CPoint point) {// TODO: add the message processing program code and/or call the default const int borderwidth = 7; CRect rect; GetClientRect (rect ); screenToClient (& point); if (point. y <borderwidth) {return HTTOP;} if (point. x <borderwidth) {return HTLEFT;} if (point. y> rect. bottom-rect. top-borderwidth & point. x> rect. right-rect. left-borderwidth) return HTBOTTOMRIGHT; if (point. y> rect. bottom-rect. top-borderwidth) {return HTBOTTOM;} if (point. x> rect. right-rect. left-borderwidth) {return HTRIGHT;} return HTCAPTION; // return CDialog: OnNcHitTest (point);} void CbarDlg: OnNcLButtonDown (UINT nHitTest, CPoint point) {// TODO: add the message processing program code and/or call the default value if (nHitTest = HTTOP) sendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_TOP, MAKELPARAM (point. x, point. y); else if (nHitTest = HTBOTTOM) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_BOTTOM, MAKELPARAM (point. x, point. y); else if (nHitTest = HTLEFT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_LEFT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTRIGHT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_RIGHT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTTOPLEFT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_TOPLEFT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTTOPRIGHT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_TOPRIGHT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTBOTTOMLEFT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_BOTTOMLEFT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTBOTTOMRIGHT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_BOTTOMRIGHT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTCAPTION) SendMessage (WM_SYSCOMMAND, SC _MOVE | 4, MAKELPARAM (point. x, point. y ));}