Static removal of the long lift border is simple, directly set the "Border" property is "none" can
"Maximize Box", "Minimize box" set whether to display the Maximize/minimize button;
"System Menu" setting whether the Close button is displayed;
1. How to dynamically remove form borders in your code
DWORD dwstyle = GetStyle (); Equivalent to GetWindowLong (M_hwnd, Gwl_style);D word dwnewstyle = Ws_sysmenu | Ws_minimizebox | Ws_maximizebox | Ws_clipchildren | Ws_clipsiblings;dwnewstyle &= ~dwstyle; SetWindowLong (M_hwnd, Gwl_style, Dwnewstyle);
Or
LONG Nstyle = GetWindowLong (m_hwnd, Gwl_style); LONG NewStyle = Nstyle & (~ (Ws_caption | Ws_border | Ws_thickframe)); Remove Attributes Ws_ex_clientedgesetwindowlong (m_hwnd, Gwl_style, NewStyle);:: SetWindowPos (m_hwnd, NULL, 0, 0, 0, 0, swp_nomove | Swp_nosize | swp_framechanged); swp_framechanged ensure immediate effect
2. How to set the form as the bottommost form
SetWindowPos (&wndbottom, 0, 0, 0, 0, swp_nosize | Swp_nomove | Swp_noactivate); or:: SetWindowPos (GetSafeHwnd (), hwnd_topmost, 0, 0, 0, 0, swp_nosize | Swp_nomove | Swp_noactivate);
3. How to set the form to the top-level form
SetWindowPos (&wndtopmost, 0, 0, 0, 0, swp_nosize | Swp_nomove | Swp_noactivate); or:: SetWindowPos (GetSafeHwnd (), hwnd_topmost, 0, 0, 0, 0, swp_nosize | Swp_nomove | Swp_noactivate);
Notes (1):
Wndbottom and wndTopMost are static members of the base class CWnd, defined as follows:
Static Afx_data const CWND wndtop; SetWindowPos ' s pwndinsertafterstatic afx_data const CWnd wndbottom; SetWindowPos ' s pwndinsertafterstatic afx_data const CWnd wndtopmost; SetWindowPos pwndinsertafterstatic afx_data const CWND wndnotopmost; SetWindowPos pWndInsertAfter
Notes (2):
Swp_drawframe Draws a box around the window swp_framechanged sends a WM_NCCALCSIZE message into the window, even if the size of the window does not change. If you do not specify this parameter, the message wm_ Nccalcsize only send Swp_hidewindow hidden window when the window size changes swp_showwindow display window Swp_noredraw window does not automatically redraw <span style= " Color: #ff0000; " >swp_noactivate do not activate window (avoid grabbing focus) </span>swp_nocopybits block Customer area <span style= "color: #ff0000;" >swp_nomove Keep current position (x and Y parameters will be ignored) swp_nosize keep current size (CX and CY parameters are ignored) </span><span style= "color:# ff0000; " >swp_nozorder keeps the window in the current position of the list (the Hwndinsertafter parameter is ignored) Swp_noownerzorder does not change the position and order of all Windows </span> Swp_noreposition is the same as the Swp_noownerzorder tag swp_nosendchanging
4. Set the form to display full screen
int cxscreen,cyscreen; Cxscreen=getsystemmetrics (Sm_cxscreen); Cyscreen=getsystemmetrics (Sm_cyscreen); SetWindowPos (&wndtopmost,0,0,cxscreen,cyscreen,swp_showwindow);
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MFC forms to border, top, full screen, activate