home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / FILEDLG6.ZIP / ERRMSG.ZIP / EXAMPLE.C < prev    next >
C/C++ Source or Header  |  1990-11-14  |  1KB  |  35 lines

  1. /****************************************************************************
  2.  * EXAMPLE.C -- Example program showing how to use the ErrMessageBox        *
  3.  *              function with a user defined error list.                    *
  4.  ****************************************************************************/
  5. #define INCL_WINWINDOWMGR
  6. #define INCL_WINMESSAGEMGR
  7. #define INCL_WINDIALOGS
  8. #include <os2.h>
  9. #include <errmsg.h>
  10.  
  11. ERRORMSG errmsg[] = {
  12.     1,MB_OK|MB_ICONEXCLAMATION,"Message with no arguments.",
  13.     2,MB_OK|MB_ICONEXCLAMATION,"Test message with\n  int argument = %i\n  string argument = \"%s\".",
  14.     3,MB_OK|MB_ICONEXCLAMATION,"Test message with\n  floating point argument = %lf.\n",
  15.     4,MB_YESNO|MB_ICONQUESTION,"Message asking for user response."
  16.     };
  17. #define COUNT (sizeof(errmsg) / sizeof(ERRORMSG))
  18.  
  19. void main( void )
  20. {
  21.     HAB     hab;    /* handle to the anchor block  */
  22.     HMQ     hmq;    /* handle to the message queue */
  23.  
  24.     hab = WinInitialize( 0 );
  25.     hmq = WinCreateMsgQueue(hab, DEFAULT_QUEUE_SIZE);
  26.  
  27.     ErrMessageBox( HWND_DESKTOP,NULL,1,errmsg,COUNT );
  28.     ErrMessageBox( HWND_DESKTOP,NULL,2,errmsg,COUNT,100,(PSZ)"INSERTED STRING" );
  29.     ErrMessageBox( HWND_DESKTOP,NULL,3,errmsg,COUNT,3.1415926 );
  30.     ErrMessageBox( HWND_DESKTOP,NULL,4,errmsg,COUNT );
  31.  
  32.     WinDestroyMsgQueue(hmq);
  33.     WinTerminate(hab);
  34. }
  35.