home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 32 Periodic / 32-Periodic.zip / revue1b.zip / TEST1.CPP < prev    next >
Text File  |  1993-11-28  |  1KB  |  63 lines

  1.  #define INCL_PM
  2.  #include <os2.h>
  3.  
  4. MRESULT EXPENTRY WinPrincipal( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
  5.  
  6.  
  7. MRESULT EXPENTRY WinPrincipal( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  8.  {
  9.      switch( msg )
  10.      {
  11.     case WM_CREATE:
  12.     break;
  13.  
  14.     case WM_CLOSE:
  15.           if(WinMessageBox(HWND_DESKTOP, hwnd,
  16.              "Voulez-vous vraiment quitter cette application?",
  17.              "Juste pour être certain...", 0,
  18.              MB_YESNO | MB_QUERY)
  19.             == MBID_YES) WinPostMsg(hwnd,WM_QUIT,MPVOID,MPVOID);
  20.     break;
  21.  
  22.     case WM_ERASEBACKGROUND:
  23.     return(MRESULT)(TRUE);
  24.  
  25.     default:
  26.     return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  27.      }
  28.  return (0);
  29.  }
  30.  
  31.  
  32.  int main(void)
  33.  {
  34.      HAB hab;
  35.      HMQ  hmq;
  36.      HWND hwndFrame;
  37.      QMSG qmsg;
  38.      ULONG flCreate;
  39.      char titre1[] = "Calcul";
  40.  
  41.      hab = WinInitialize(0);
  42.      if (!hab) return 1;
  43.  
  44.      hmq = WinCreateMsgQueue(hab, 0);
  45.      if (!hmq) return 1;
  46.  
  47.      WinRegisterClass(hab, (PSZ)"Principale", WinPrincipal, CS_SIZEREDRAW, 0);
  48.  
  49.      flCreate = FCF_SIZEBORDER | FCF_SYSMENU |
  50.          FCF_MINMAX | FCF_SHELLPOSITION | FCF_TITLEBAR;
  51.  
  52.      hwndFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE,
  53.     &flCreate, "Principale", titre1, 0L, NULLHANDLE, 0, NULL);
  54.  
  55.      while( WinGetMsg( hab, &qmsg, 0L, 0, 0 ) )
  56.        WinDispatchMsg( hab, &qmsg );
  57.  
  58.      WinDestroyWindow(hwndFrame);
  59.      WinDestroyMsgQueue( hmq );
  60.      WinTerminate( hab );
  61.      return 0;
  62.  }
  63.