获取指定窗口窗口风格

API函数:
  1. LONG GetWindowLong(

  2.     HWND hWnd,  // handle of window
  3.     int nIndex  // offset of value to retrieve
  4.    );
设置nIndex:GWL_STYLE
然后,函数GetWindowLong函数的返回值和相应的参数做与运算,结果为1,则属于相应风格,反之则反。
窗口风格参数如下:
  1.    1. Style        Meaning
  2.    2. WS_BORDER   //Creates a window that has a thin-line border.
  3.    3. WS_CAPTION  //Creates a window that has a title bar (includes the WS_BORDER style).
  4.    4. WS_CHILD    //Creates a child window. This style cannot be used with the WS_POPUP style.
  5.    5. WS_CHILDWINDOW  //Same as the WS_CHILD style.
  6.    6. WS_CLIPCHILDREN //Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window.
  7.    7. WS_CLIPSIBLINGS //Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.
  8.    8. WS_DISABLED //Creates a window that is initially disabled. A disabled window cannot receive input from the user.
  9.    9. WS_DLGFRAME //Creates a window that has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar.
  10.   10. WS_GROUP    //Specifies the first control of a group of controls. The group consists of this first control and all  controls defined after it, up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.
  11.   11. WS_HSCROLL  //Creates a window that has a horizontal scroll bar.
  12.   12. WS_ICONIC   //Creates a window that is initially minimized. Same as the WS_MINIMIZE style.
  13.   13. WS_MAXIMIZE //Creates a window that is initially maximized.
  14.   14. WS_MAXIMIZEBOX  //Creates a window that has a Maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified. 
  15.   15. WS_MINIMIZE //Creates a window that is initially minimized. Same as the WS_ICONIC style.
  16.   16. WS_MINIMIZEBOX  //Creates a window that has a Minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified. 
  17.   17. WS_OVERLAPPED   //Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style.
  18.   18. WS_OVERLAPPEDWINDOW //Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style. 
  19.   19. WS_POPUP    //Creates a pop-up window. This style cannot be used with the WS_CHILD style.
  20.   20. WS_POPUPWINDOW //Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.
  21.   21. WS_SIZEBOX  //Creates a window that has a sizing border. Same as the WS_THICKFRAME style.
  22.   22. WS_SYSMENU  //Creates a window that has a window-menu on its title bar. The WS_CAPTION style must also be specified.
  23.   23. WS_TABSTOP  //Specifies a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.
  24.   24. WS_THICKFRAME   //Creates a window that has a sizing border. Same as the WS_SIZEBOX style.
  25.   25. WS_TILED    //Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style. 
  26.   26. WS_TILEDWINDOW  //Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style. 
  27.   27. WS_VISIBLE  //Creates a window that is initially visible.
  28.   28. WS_VSCROLL  //Creates a window that has a vertical scroll bar.

  1.    1.  The following button styles (in the BUTTON class) can be specified in the dwStyle parameter:  
  2.    2.
  3.    3. Style              Meaning
  4.    4. BS_3STATE   //Creates a button that is the same as a check box, except that the box can be grayed as well as checked or unchecked. Use the grayed state to show that the state of the check box is not determined.
  5.    5. BS_AUTO3STATE//Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and unchecked.
  6.    6. BS_AUTOCHECKBOX //Creates a button that is the same as a check box, except that the check state automatically toggles between checked and unchecked each time the user selects the check box.
  7.    7. BS_AUTORADIOBUTTON  //Creates a button that is the same as a radio button, except that when the user selects it, Windows automatically sets the button's check state to checked and automatically sets the check state for all other buttons in the same group to unchecked.
  8.    8. BS_CHECKBOX //Creates a small, empty check box with text. By default, the text is displayed to the right of the check box. To display the text to the left of the check box, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style).
  9.    9. BS_DEFPUSHBUTTON    //Creates a push button that behaves like a BS_PUSHBUTTON style button, but also has a heavy black border. If the button is in a dialog box, th
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值