home *** CD-ROM | disk | FTP | other *** search
/ Windoware / WINDOWARE_1_6.iso / source / winclass / test.cpp < prev    next >
C/C++ Source or Header  |  1991-03-19  |  2KB  |  55 lines

  1. #include <windows.h>
  2. #include "winstd.h"
  3. #include "dlgbase.h"
  4. #include "test.h"
  5. #include "testm.h"
  6.  
  7. long FAR PASCAL _export WndProc(HWND,WORD,WORD,LONG);
  8.  
  9. #pragma argsused
  10. int PASCAL WinMain(HANDLE hInstance,HANDLE hPrevInstance,
  11.            LPSTR lpszCmdLine,int nCmdShow)
  12. {                                                //Register "Test" class
  13.     StdRegClass Reg("Test",hInstance,hPrevInstance,WndProc,"amenu","test");
  14.     StdWin Win("Test", "Test", hInstance);       //Make an instance
  15.  
  16.     Win.Create();                                // Create it
  17.     Win.Display();                               // Show it
  18.     Win.Update();
  19.     Win.MessageLoop();                           // Go Windows.....
  20.     return 0;
  21. }
  22.  
  23. #pragma argsused
  24. long FAR PASCAL _export WndProc(HWND hwnd,WORD message,WORD wParam,
  25.                                 LONG lParam)
  26. {
  27.     HANDLE hInstance; 
  28.  
  29.     switch(message)
  30.     {
  31.  
  32.     case WM_CREATE:
  33.         hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
  34.         static TDlg Testdlg(hInstance, "aboutbox", hwnd); //MUST be static !
  35.         return 0;                           // Create dialog
  36.  
  37.     case WM_COMMAND:
  38.         switch(wParam)
  39.         {
  40.             case IDM_SILLY:
  41.                 MessageBox(hwnd,"Feature not implemented",NULL,
  42.                             MB_OK | MB_ICONQUESTION);
  43.                 return 0;
  44.  
  45.             case IDM_ABOUT:
  46.                 Testdlg.Show();             // Show it
  47.                 return 0;
  48.         }
  49.     case WM_DESTROY:
  50.         PostQuitMessage(0);
  51.         return 0;
  52.     }
  53.     return DefWindowProc(hwnd,message,wParam, lParam);
  54. }
  55.