#include using namespace wkgl; //Callback prototypes BOOL OnButton( Component*, UINT, WPARAM, LPARAM ); WPARAM main() { Window win( "My Second Window" ); Button button( "Test Button", 0, 0 ); //Add the button to the window. win.add( &button ); //Add the callback for the button button.addCallBack( OnButton ); //Show the window win.show(); return win.beginMessageLoop(); } //Callback for button BOOL OnButton( Component *com, UINT message, WPARAM wParam, LPARAM lParam ) { static char buf[50]; //Buffer for buttons text. static int clicked; //Number of times the button has been clicked if ( message == BN_CLICKED ) { sprintf( buf, "You clicked the button: %i times", ++clicked ); //Set the button's text. ((Control*)com)->setText( buf ); return TRUE; } return FALSE; }