text: how to display a message box on the click event of a button in windows programming (vc++) ? hi folks!... i have created a window and a button on it using vc++ 6.0. now, i want to display a messagebox in response of the click event of button. please guide me what code to write in the windows procedure?. here is the windows procedure:  /* assume that the main window name is window1 and button name is button1 */  lresult callback windowprocedure (hwnd hwnd, uint message, wparam wparam, lparam lparam) {     switch (message)                  /* handle the messages */     {         case wm_destroy:              postquitmessage (0);       /* send a wm_quit to the message queue */             break;           default:                      /* for messages that we don't deal with */              return defwindowproc (hwnd, message, wparam, lparam);     }      return 0; } hello,  you have to check for the event wm_command in your switch instruction. and inside that case, check the wparam value (high order byte) of the event to make sure it is a bn_clicked event. at that stage, you need to further identify your button using the wparam (low order byte) of the wparam.  example:          case wm_command:            if (hiword(wparam) == bn_clicked)            {                  switch (loword(wparam))                  {                      case id_of_your_buton:                          messagebox(hwnd, "hello", "testing", mb_ok);                           break;                  }            }            break;    i suggest that you take a look to the doc of vc++ on these events, mainly in the windows sdk doc about buttons. it is well done with code samples.  additional note: as you created your button directly on a window instead of within a dialog box, it is very likely that you used a call to the createwindow function to create it. in this case, you give the id number in parameter hmenu hmenu of the function. you may create a resource id (it is just an value globally defined with #define) to avoid playing with numbers when you have several controls.  regards, chris. http://www.beinsoft.com