Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6536871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:32:47+00:00 2026-05-25T10:32:47+00:00

I would like to use raw winapi32 to check button style whether it is

  • 0

I would like to use raw winapi32 to check button style whether it is a checkbox button or a pushbutton.

bool isPushBtn(HWND hBtn, DWORD dwStyle)
{
   return (0!=dwStyle | GetWindowLong(hBtn,GWL_STYLE));
}

But this always returns false. Do you know a way to check this ? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:32:48+00:00Added an answer on May 25, 2026 at 10:32 am

    In order to understand how button styles work we need to look at the values used by the style constants:

    #define BS_PUSHBUTTON       0x00000000L
    #define BS_DEFPUSHBUTTON    0x00000001L
    #define BS_CHECKBOX         0x00000002L
    #define BS_AUTOCHECKBOX     0x00000003L
    #define BS_RADIOBUTTON      0x00000004L
    #define BS_3STATE           0x00000005L
    #define BS_AUTO3STATE       0x00000006L
    #define BS_GROUPBOX         0x00000007L
    #define BS_USERBUTTON       0x00000008L
    #define BS_AUTORADIOBUTTON  0x00000009L
    #define BS_PUSHBOX          0x0000000AL
    #define BS_OWNERDRAW        0x0000000BL
    #define BS_TYPEMASK         0x0000000FL
    #define BS_LEFTTEXT         0x00000020L
    
    #define BS_TEXT             0x00000000L
    #define BS_ICON             0x00000040L
    #define BS_BITMAP           0x00000080L
    #define BS_LEFT             0x00000100L
    #define BS_RIGHT            0x00000200L
    #define BS_CENTER           0x00000300L
    #define BS_TOP              0x00000400L
    #define BS_BOTTOM           0x00000800L
    #define BS_VCENTER          0x00000C00L
    #define BS_PUSHLIKE         0x00001000L
    #define BS_MULTILINE        0x00002000L
    #define BS_NOTIFY           0x00004000L
    #define BS_FLAT             0x00008000L
    #define BS_RIGHTBUTTON      BS_LEFTTEXT
    

    The other essential reference is the Button Styles topic at MSDN. However, what that document does not explain is that the BS_PUSHBUTTON to BS_OWNERDRAW flags, the type flags, are mutually exclusive. The other flags can be used in combination with one of the type flags. This can be inferred from the bit patterns of the values.

    The documentation for BS_TYPEMASK states:

    Windows 2000: A composite style bit that results from using the OR operator on BS_* style bits. It can be used to mask out valid BS_* bits from a given bitmask. Note that this is out of date and does not correctly include all valid styles. Thus, you should not use this style.

    However I think this is misleading and endorse what ybungalobill said in his answer. No harm can come of following that advice.

    In other words you should mask the style with BS_TYPEMASK and then test for a particular button type.

    bool isButtonType(HWND hBtn, DWORD dwType)
    {
         assert(dwType<=BS_TYPEMASK);
         return (GetWindowLong(hBtn, GWL_STYLE) & BS_TYPEMASK) == dwType;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use BULK INSERT to load a few hundred raw data
I am using AdoNetAppender (SQL server) in my asp.net application and would like use
I would like to use a language that I am familiar with - Java,
I would like to use something like CLR Profiles on .Net 2.0 to see
I would like to use as and is as members of an enumeration. I
I would like to use a component that exposes the datasource property, but instead
I would like to use client-side Javascript to perform a DNS lookup (hostname to
I would like to use javascript to develop general-purpose GUI applications. Initially these are
I would like to use my laptop as a web development (PHP, Python, etc.)
I would like to use Emacs to edit some VB6 files but Emacs does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.