home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / WINTEMP2.ZIP / DLG.C < prev    next >
C/C++ Source or Header  |  1991-03-29  |  2KB  |  72 lines

  1. #define INCL_WIN
  2. #define INCL_GPI
  3. #include <os2.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <smslib.h>
  7. #include <stdio.h>
  8.  
  9. #define ID_DLG   10
  10. #define ID_FRAME 11
  11. #define ID_MENU  12
  12.  
  13. MRESULT EXPENTRY ClientWinProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  14.  
  15. HAB   hab;
  16. CHAR  bug_buf[100];
  17.  
  18. USHORT cdecl main(void)
  19. {
  20.     HMQ   hmq;
  21.     QMSG  qmsg;
  22.     HWND  hwnd;
  23.  
  24.     static CHAR szClientClass[] = "Client Window";
  25.  
  26.     hab = WinInitialize(0);
  27.     hmq = WinCreateMsgQueue(hab, 0);
  28.  
  29.     WinRegisterClass((HAB)hab, (PSZ)szClientClass, (PFNWP)ClientWinProc,
  30.                       CS_SIZEREDRAW | CS_PARENTCLIP | CS_CLIPSIBLINGS, 0);
  31.  
  32.     hwnd = WinLoadDlg(HWND_DESKTOP, HWND_DESKTOP, NULL, NULL, ID_DLG, NULL);
  33.  
  34.     while (WinGetMsg(hab, &qmsg, NULL, 0, 0))
  35.          WinDispatchMsg(hab, &qmsg);
  36.  
  37.     WinDestroyWindow(hwnd);
  38.     WinDestroyMsgQueue(hmq);
  39.     WinTerminate(hab);
  40.  
  41.     return 0;
  42.  
  43. }
  44.  
  45. MRESULT EXPENTRY ClientWinProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  46. {
  47.       HWND hwndSMS;
  48.       HWND hwndMenu;
  49.  
  50.       switch  (msg)
  51.       {
  52.  
  53.           case WM_CREATE:
  54.               WinPostMsg(hwnd, WM_USER+1,0L,0L);
  55.               return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  56.               break;
  57.           case WM_USER+1:
  58.             hwndSMS=WinQueryWindow(hwnd, QW_PARENT,FALSE);
  59.             hwndMenu=WinLoadMenu(hwndSMS,NULL,ID_MENU);
  60.             WinSendMsg(hwndSMS, WM_UPDATEFRAME, (ULONG)FCF_MENU, NULL);
  61.             WinSetWindowPos(hwndSMS,HWND_TOP,50,50,150,150,SWP_MOVE|SWP_SHOW|SWP_SIZE|SWP_ACTIVATE);
  62.             break;
  63.           case WM_ERASEBACKGROUND:
  64.             return ((MRESULT)TRUE);
  65.             break;
  66.           default:
  67.              return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  68.              break;
  69.     }
  70.     return (MRESULT)NULL;
  71. }
  72.