Click here to Skip to main content
14,977,910 members
Articles / Desktop Programming / WTL
Posted 12 Jun 2001


40 bookmarked

Davide Calabro's CButtonST class port to WTL

Rate me:
Please Sign up or sign in to vote.
4.73/5 (9 votes)
26 Jun 2001
A fully featured owner-draw button class






Now you can use Davide Calabro's excellent CButtonSt class in your ATL/WTL projects. The Class is still called CButtonSt and it retains a majority of the original code. Just follow these simple instructions:

  1. Create a WTL Project
  2. Design the dialog and add the button controls
  3. Add the ButtonST.h header file to your project
  4. Assign a CButtonSt to each button.
  5. In OnInitDialog,
    • Subclass each member controls (CButtonST) to each ID using the SubclassWindow method.
    • uses the CButtonSt methods to change the appearance of the control.
  6. In your dialog, don't forget to add the macro REFLECT_NOTIFICATIONS which allows the buttons to get messages like WM_DRAWITEM.
class MyDialog : public CDialogImpl<MyDialog>
  LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, 
    LPARAM /*lParam*/, BOOL& /*bHandled*/);
  CButtonST m_btn;

LRESULT MyDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/,
  LPARAM /*lParam*/, BOOL& /*bHandled*/) 

See Davide Calabro's original CButtonSt article for more details.

Latest Updates

  • 26 June 2001
    • Updated to Davide Calabro's version 3.2
    • Added support for defining the icons from an image list
    • Added support for creating dynamically the buttons
  • 14 June 2001 - Fixed a bug in the autorepeat feature

Serge Image 5 Thank you.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Serge Weinstock
Web Developer
United Kingdom United Kingdom
No Biography provided

Comments and Discussions

GeneralTHANK YOU! Pin
lzhishen17-Sep-10 20:28
Memberlzhishen17-Sep-10 20:28 
GeneralSelectObject(pbmpOldBk) Bug Pin
freesindbad17-Feb-10 20:59
Memberfreesindbad17-Feb-10 20:59 
GeneralThank you ! Pin
flg61873024-Nov-09 0:51
Memberflg61873024-Nov-09 0:51 
Generalloading in dialog bar Pin
anubis_ex21-Jun-05 10:37
Memberanubis_ex21-Jun-05 10:37 
GeneralSome bugs. Pin
t2di4u24-Nov-04 22:45
Membert2di4u24-Nov-04 22:45 
GeneralAnother resource leak when using icons Pin
Markus Steinlein11-Aug-04 0:05
sussMarkus Steinlein11-Aug-04 0:05 
GeneralPort STButton 3.9! Pin
Rodger12-May-03 5:23
MemberRodger12-May-03 5:23 
GeneralBug, resource leak Pin
John Gijs23-Apr-03 0:03
MemberJohn Gijs23-Apr-03 0:03 
Generalm_bIsFlat - classic appearance and cool behavior Pin
23-Apr-02 3:57
suss23-Apr-02 3:57 
GeneralKeyboard Input Pin
25-Jan-02 8:12
suss25-Jan-02 8:12 
Generalterrific article, ... one suggestion :) Pin
14-Aug-01 8:50
suss14-Aug-01 8:50 
Generalerror C2065: ImageList_Read and ImageList_Write Pin
Odissey20-Jun-01 19:23
MemberOdissey20-Jun-01 19:23 
GeneralRe: error C2065: ImageList_Read and ImageList_Write Pin
Serge Weinstock21-Jun-01 7:23
MemberSerge Weinstock21-Jun-01 7:23 
GeneralRe: error C2065: ImageList_Read and ImageList_Write Pin
12-Jul-01 22:26
suss12-Jul-01 22:26 
GeneralRe: error C2065: ImageList_Read and ImageList_Write Pin
20-Mar-02 23:51
suss20-Mar-02 23:51 
GeneralLockup Pin
Todd Smith13-Jun-01 12:50
MemberTodd Smith13-Jun-01 12:50 
GeneralRe: Lockup Pin
Maximilian Hänel13-Jun-01 14:11
MemberMaximilian Hänel13-Jun-01 14:11 
GeneralRe: Lockup Pin
Serge Weinstock13-Jun-01 22:23
MemberSerge Weinstock13-Jun-01 22:23 
GeneralGreat! Pin
Maximilian Hänel13-Jun-01 2:07
MemberMaximilian Hänel13-Jun-01 2:07 
GeneralThanks! Pin
Davide Calabro12-Jun-01 23:06
MemberDavide Calabro12-Jun-01 23:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.