MFC no Border dialog box moves

Source: Internet
Author: User

When the window determines the mouse position, Windows sends a WM_NCHITTEST message to the window, allowing the message to be processed so that Windows considers the mouse to be on the title bar as soon as the mouse is inside the window. This requires the Onnchittest function that overloads the CWnd class to handle the WM_NCHITTEST message, calling the function of the parent class in the function, and if returning htclient, indicating that the mouse is in the window client area, so that the overloaded function returns Htcaption, Causes Windows to mistakenly assume that the mouse is on the title bar.

When the user presses the left mouse button in the window client area, causes Windows to think that the mouse is on the title bar, that is, to send a wparam parameter to htcaption in the processing function OnLButtonDown processing the WM_LBUTTONDOWN message, LPARAM The Wm_nclbuttondown message for the current coordinate.

1 void Ctmfcddlg::onlbuttondown (UINT nflags, CPoint point) 2 {3     // todo:add your message handler code here and/or call default 4 5     Cdialogex::onlbuttondown (nflags, point); 6 7     PostMessage (Wm_nclbuttondown, Htcaption, Makelparam (Point.x, Point.y)); 8 }

or SendMessage (wm_syscommand,0xf012,0);

MFC no Border dialog box moves

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.