home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / MQSRC.LZH / MQ.C < prev    next >
C/C++ Source or Header  |  1991-05-05  |  2KB  |  77 lines

  1. #define INCL_WIN
  2. #include <os2.h>
  3. #include "mq.h"
  4.  
  5.  
  6. MRESULT EXPENTRY MainWinProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  7. {
  8.     HPS hps;
  9.     RECTL rcl;
  10.  
  11.     switch(msg){
  12.         case WM_PAINT:
  13.             hps = WinBeginPaint(hwnd,  NULL, &rcl);
  14.             WinFillRect(hps, &rcl, CLR_WHITE);
  15.             WinEndPaint(hps);
  16.             break;
  17.         case WM_ERASEBACKGROUND:
  18.             return((MRESULT)TRUE);
  19.         case WM_COMMAND:
  20.             switch( SHORT1FROMMP(mp1)){
  21.                 case IDM_NEW:
  22.                     OpenNewMleWin(hwnd);
  23.                     break;
  24.             }
  25.             break;
  26.         default:
  27.             return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  28.     }
  29.     return(0);
  30. }
  31.  
  32.  
  33.  
  34. int cdecl main(void)
  35. {
  36.     ULONG flstyle;
  37.     HMQ hmq;
  38.     QMSG qmsg;
  39.     HAB hab;
  40.     char *szClass = "foo";
  41.     HWND hwndFrame, hwndClient;
  42.  
  43.     hab = WinInitialize(0);
  44.     hmq = WinCreateMsgQueue(hab, 0); /*DEFAULT_QUEUE_SIZE);*/
  45.  
  46.  
  47.     if(!WinRegisterClass(hab, szClass, MainWinProc, 0L, 0))
  48.         return(1);
  49.  
  50.     if(!WinRegisterClass(hab, "MyMLE", MleWinProc, CS_SIZEREDRAW, sizeof(PVOID)))
  51.         return(1);
  52.  
  53.     flstyle = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX |
  54.         FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU;
  55.  
  56.     hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
  57.         0L,                     /* frame-window style            */
  58.         &flstyle,               /* window style                  */
  59.         szClass,                /* class name                    */
  60.         NULL,                   /* window title                  */
  61.         0L,                     /* default client style          */
  62.         0,                      /* resource in executable file   */
  63.         ID_MAIN     ,           /* resource id                   */
  64.         &hwndClient);           /* receives client window handle */
  65.  
  66.     if(!hwndFrame)
  67.         return(1);
  68.  
  69.     WinShowWindow(hwndFrame, TRUE);
  70.  
  71.     while (WinGetMsg(hab, &qmsg, NULL, 0, 0))
  72.         WinDispatchMsg(hab, &qmsg);
  73.  
  74.     WinDestroyMsgQueue(hmq);
  75.     WinTerminate(hab);
  76. }
  77.