home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / sampl254.zip / gcc2 / samples / sample3 / stdmain.cc < prev    next >
C/C++ Source or Header  |  1993-04-11  |  4KB  |  85 lines

  1.  
  2. //**************************************************************************
  3. #include <stdlib.h>
  4. #include "sample3.h"
  5. #include "process.h"
  6. //**************************************************************************
  7.  
  8. extern "C"
  9.    {
  10.     MRESULT ClientWndProc (HWND, USHORT, MPARAM, MPARAM);
  11.    }
  12.  
  13. //  ********* Global Variables *********************************************
  14.  
  15. Process        Proc;
  16.  
  17. // *************************************************************************
  18.  
  19. int     main (int       argc,
  20.               char *    argv[])
  21.  
  22.   {//  Variable Declarations
  23.  
  24.    static  ULONG    flFrameFlags = FCF_TITLEBAR       |
  25.                                    FCF_SYSMENU        |
  26.                                    FCF_SIZEBORDER     |
  27.                                    FCF_MINMAX         |
  28.                                    FCF_SHELLPOSITION  |
  29.                                    FCF_TASKLIST       |
  30.                                    FCF_VERTSCROLL     |
  31.                                    FCF_HORZSCROLL     |
  32.                                    FCF_MENU           |
  33.                                    FCF_ICON;
  34.            HWND     hwndClient;
  35.            HWND     hwndFrame;
  36.    static  CHAR     szTitleBarText[] = "Standard Program Label";
  37.            QMSG     QueMsg;
  38.    static  CHAR     szPrvtWinClass[] = "Private Class";
  39.  
  40.    //  Register a private window class for this application.
  41.  
  42.    WinRegisterClass (Proc.AnchorBlock(),  // Anchor Block handle
  43.                (PSZ) szPrvtWinClass,      // Name of window class
  44.              (PFNWP) ClientWndProc,       // Window procedure for class   
  45.                      CS_SIZEREDRAW,       // Set redraw on window resize 
  46.                      0);                  // Extra bytes to reserve       
  47.  
  48.    //  Create a standard window frame.
  49.  
  50.    hwndFrame = WinCreateStdWindow (HWND_DESKTOP,         // Create a parent window                
  51.                                    WS_VISIBLE      |     // Make the window visible               
  52.                                      FS_ACCELTABLE |     // Use accelerator table               
  53.                                      FS_ICON,            // Use Icon                            
  54.                                    &flFrameFlags,        // Creation flags                        
  55.                              (PSZ) szPrvtWinClass,       // window class name                     
  56.                              (PSZ) szTitleBarText,       // Title bar text                        
  57.                                    0L,                   // Style of client window                
  58.                          (HMODULE) NULL,                 // Resource is in application module     
  59.                                    ID_RESOURCE,          // ID of resources for this frame window 
  60.                                    &hwndClient);         // Returned client window handle         
  61.  
  62.    //  Standard message processing loop. WinGetMsg returns FALSE if the  
  63.    //  returned message is WM_QUIT.  Returns TRUE for all other messages 
  64.  
  65.    while (WinGetMsg (Proc.AnchorBlock(),   // Anchor block handle                 
  66.                      &QueMsg,            // Pointer to queue message structure  
  67.                      0,               // No window message filter            
  68.                      0,                  // Retrieve all messages               
  69.                      0))                 // Retrieve all messages               
  70.      {WinDispatchMsg(Proc.AnchorBlock(),   // Anchor block handle       
  71.                      &QueMsg);           // structure holding message 
  72.      }
  73.  
  74.    //  The WM_QUIT message has been received.  Destroy window.  Destroy  
  75.    //  message queue.  Let go of anchor block.                           
  76.  
  77.    WinDestroyWindow(hwndFrame);
  78.  
  79.    //  Terminate program. 
  80.  
  81.    return 0;
  82.  
  83.   }
  84.  
  85.