[comp.windows.ms.programmer] BS_USERBUTTON vs. BS_OWNERDRAW

SASTPH@vm.sas.com (Tim Hunter) (05/24/91)

Apparently there are two kinds of "owner draw" buttons in Windows 3.0.
Petzold documents the BS_USERBUTTON style but not the BS_OWNERDRAW
style.  The SDK documentation describes the BS_OWNERDRAW style but
not the BS_USERBUTTON style.  The BS_USERBUTTON style seems slightly
less functional.

I'm new to Windows programming, but my guess is that the BS_USERBUTTON
style was present in earlier releases of Windows and has been superceded
by the BS_OWNERDRAW style.  Am I right?  Does anybody know some history
behind the two styles?  More importantly, is there any reason to prefer
the BS_OWNERDRAW style if the BS_USERBUTTON style provides sufficient
functionality?  Known bugs, etc.?

Gary_Capps@p27.f30.n147.z1.fidonet.org (Gary Capps) (05/30/91)

In a message of <23 May 91 22:47:39> Tim Hunter wrote to All:

 TH>I'm new to Windows programming, but my guess is that the BS_USERBUTTON
 TH>style was present in earlier releases of Windows and has been superceded
 TH>by the BS_OWNERDRAW style.  Am I right?

Bingo.

 TH>behind the two styles?  More importantly, is there any reason to prefer
 TH>the BS_OWNERDRAW style if the BS_USERBUTTON style provides sufficient
 TH>functionality?  Known bugs, etc.?

The difference is primarily in how the button talks to its parent.  The 
BS_USERBUTTON sends WM_COMMAND messages with BN_xxxx notifications in wParam 
while the BS_OWNERDRAW button sends WM_DRAWITEM and WM_MEASUREITEM messages 
with lParam pointing to control structures that contain the button's hDC, 
client rectangle, status bits, etc.  You should stick to BS_OWNERDRAW buttons, 
'cause there's probably a better than even chance that the BS_USERBUTTON will 
be phased out.

gc