home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / os2 / filedlg5 / errmsg / example / example.c next >
Encoding:
C/C++ Source or Header  |  1989-11-28  |  1.7 KB  |  39 lines

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