home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / mag&info / msjv7_5.zip / WINCPP.ARJ / CPP3.ARJ / WINAPP.CPP < prev    next >
C/C++ Source or Header  |  1992-09-01  |  2KB  |  71 lines

  1. #include"WinApp.h"
  2.  
  3. BOOL CALLBACK _export AboutDlg(HWND, UINT, WPARAM, LPARAM);
  4.  
  5. HINSTANCE   WinApphInstance = 0;
  6. HINSTANCE   WinApphPrevInstance = 0;
  7. LPSTR       WinApplpCmdLine = NULL;
  8. int         WinAppnCmdShow = 0;
  9. WinApp *pWinApp = NULL;
  10.  
  11. int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, 
  12.     LPSTR lpCmdLine, int nCmdShow)
  13.     {
  14. #if defined(DEBUG)
  15.     assert(pWinApp != NULL); // WinApp pointer should be valid
  16. #endif
  17.         // initialize the myApp object, theApp
  18.     pWinApp->Init(hInstance,hPrevInstance,lpCmdLine,nCmdShow);
  19.  
  20.         // the following is the same logic as GENERIC.C
  21.     if(!pWinApp->PrevInstance())
  22.         if(!pWinApp->InitApplication())
  23.             return FALSE;
  24.  
  25.         // Perform initializations that apply to a specific instance 
  26.     if(!pWinApp->InitInstance())
  27.         return FALSE;
  28.  
  29.     // Acquire and dispatch messages until a WM_QUIT message is received. 
  30.     MSG msg;            // message                 
  31.  
  32.     while(GetMessage(&msg,       // message structure                 
  33.         NULL,           // handle of window receiving the message 
  34.         NULL,           // lowest message to examine             
  35.         NULL))           // highest message to examine         
  36.         {
  37.         TranslateMessage(&msg);       // Translates virtual key codes         
  38.         DispatchMessage(&msg);       // Dispatches message to window         
  39.         }
  40.     return(int)msg.wParam;       // Returns the value from PostQuitMessage 
  41.     }
  42.  
  43. BOOL FAR PASCAL About(HWND hWnd, LPCSTR resourceName)
  44.     {
  45.     BOOL retval = DialogBox(WinApphInstance,    // current instance         
  46.         resourceName,        // resource to use         
  47.         hWnd,                // parent handle         
  48.         (DLGPROC)AboutDlg); // AboutDlg() instance address 
  49.     return retval;
  50.     }
  51.  
  52. BOOL CALLBACK AboutDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM)
  53.     {
  54.     switch(message) 
  55.         {
  56.         case WM_INITDIALOG:           // message: initialize dialog box 
  57.             return TRUE;
  58.  
  59.         case WM_COMMAND:              // message: received a command 
  60.             if(wParam == IDOK                // "OK" box selected?         
  61.                     || wParam == IDCANCEL) 
  62.                 {      // System menu close command? 
  63.                 EndDialog(hDlg, TRUE);          // Exits the dialog box         
  64.                 return TRUE;
  65.                 }
  66.             break;
  67.         }
  68.     return FALSE;                  // Didn't process a message    
  69.     }
  70.  
  71.