Actions for the title menu bar of a Windows window--delete/disable min max session and close

Source: Internet
Author: User

HWND hand = FindWindow (NULL, "calculator");

int nstyle = GetWindowLong (hand, Gwl_style);
Nstyle &= ~ (ws_maximizebox);
SetWindowLong (hand, Gwl_style, nstyle);//Discard Maximize button
Nstyle &= ~ (ws_minimizebox);
SetWindowLong (hand, Gwl_style, nstyle);//Discard Minimized button

Delete the system menu for the entire calculator
Nstyle &= ~ (ws_sysmenu);
SetWindowLong (hand, Gwl_style, nstyle);//Discard System Menu

HWND HMenu = GetSystemMenu (hand, false);
DeleteMenu (HMenu, Sc_move, Mf_bycommand);//Do not let move
DeleteMenu (HMenu, Sc_size, Mf_bycommand);//not allowed to change size
DeleteMenu (HMenu, Sc_maximize, Mf_bycommand);//Do not maximize
DeleteMenu (HMenu, Sc_minimize, Mf_bycommand);//Don't let Minimize
DeleteMenu (HMenu, Sc_restore, Mf_bycommand);//Do not let restore
DeleteMenu (HMenu, Sc_close, Mf_bycommand);//do not let off
EnableMenuItem (HMenu, Sc_close, mf_disabled);//Disable the Close button (redraw form is not OK)

Window Style constants:

Ws_boder window has a thin border
Ws_caption window with title bar (contains Ws_boder)
Ws_child Create a child window (this style cannot be used with Ws_popup)
Ws_childwindow is the same as Ws_child
Ws_cliphildren the area occupied by the child window when drawing in the parent window.
Ws_clipsblings crops the interrelated subwindow so that a special child window receives the Ws_paint message, only works on its own window. This style is only suitable for Windows with Ws_child style.
ws_disabled Create a window that is forbidden at the beginning
Ws_dlgframe creates a window with a border of a style that is typically used with a dialog box, and a window with that style cannot have a title bar.
The ws_group specifies the first control in a set of controls, the next control with the style control terminates the current control group, and the next control group is started.
Ws_hscroll window with horizontal scroll bar
Ws_vscrool window with vertical scroll bar
Ws_maximize Window initially maximized
Ws_minimize window is initially minimized
Ws_minimizebox window with minimized button
Ws_maximizebox window with maximize button
ws_overlapped overlapping window with a title bar and border
Ws_overlappedwindow has Ws_overlapped,ws_caption,ws_sysmenu,ws_thickfram,
Overlapping windows of the Ws_minimizebox,ws_maximizebox model

Ws_popup pop-up window, cannot be used with Ws_child
Ws_popupwindow a pop-up window with a ws_boder,ws_popup,ws_sysmenu style. In order for the SYSTEM menu (also called the CONTROL menu to be visible), the ws_caption must be combined with the Ws_popupwindow style.
Ws_sysmenu has the SYSTEM menu bar, you must also specify the ws_caption style
Ws_thickframe with adjustable border
Ws_visible window is initially visible

Extended window Style constants

Ws_ex_acceptfiles window to receive drag-and-drop files
Ws_ex_dlgmodalframe has a double-line border
ws_ex_noparentnotify When a child window is created or canceled, the wm_parentnotify message is not sent to its parent window

The Ws_ex_topmost window is placed above all non-top-level windows, even if the window does not work.

Extended style support for 3D appearance

Ws_ex_clientedge creates a sunken client area for the application's main workspace, such as a text window for a word-processing program

Ws_ex_staticedge creates a sunken client area for windows that are used for output only.

Actions for the title menu bar of a Windows window--delete/disable min max session and close

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.