🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13527

Get style of a button

#13527
From: husonov
Date: Wed, 08 Oct 2003 20:05
46 lines
2743 bytes
I want to get the button style of another application, so I've been creating
a simple code which will tell me the style of any window at the current
cursor positiion using WindowFromPoint function.

I get the style of the window using GetWindowLong with GWL_STYLE flags.

As we know, actually every window is created by CreateWindow/CreateWindowEx
function where the window and button style is written in the dwStyle
parameter.

(*)dwStyle parameter is an unsigned integer value (dword).
(*)Win32 API has provide many contants for the window and button style.
(*)We can combine the window/button styles using OR operator.

For example, just say someone had created a button with this style:

WS_CHILD | WS_VISIBLE | WS_OVERLAPPED | WS_TABSTOP | BS_OWNERDRAW.

Detecting an existence of certain window flag (eg. WS_CHILD, WS_VISIBLE,
etc.) is not a problem to me because the window style constants are always
in power of 2, I can do a logical AND operator to check whether a bit is
true or false.

My problem is that many button style constants are not in power of 2,
whereas they are also specified in the dwStyle parameter. These are the
button style constants defined in Windows API :

  BS_PUSHBUTTON = 0;
  BS_DEFPUSHBUTTON = 1;
  BS_CHECKBOX = 2;
  BS_AUTOCHECKBOX = 3;
  BS_RADIOBUTTON = 4;
  BS_3STATE = 5;
  BS_AUTO3STATE = 6;
  BS_GROUPBOX = 7;
  BS_USERBUTTON = 8;
  BS_AUTORADIOBUTTON = 9;
  BS_OWNERDRAW = 11;
  etc.


How can I know mathematically/logically that someone had specified
BS_DEFPUSHBUTTON, BS_CHECKBOX, BS_RADIOBUTTON, etc. in the dwStyle
parameter?

I'm so sorry for my bad English.
Technical Details
Message-ID: <3f83ae37@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,f25c939140529f26,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-07 23:40:47 PST
Reply-To: "husonov" <husonov@borland.com>
From: "husonov" <husonov@borland.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Get style of a button
Date: Wed, 8 Oct 2003 13:05:21 -0700
Lines: 49
Organization: husonov
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: 203.77.222.187
Message-ID: <3f83ae37@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1065594423 203.77.222.187 (7 Oct 2003 23:27:03 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail