home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / enhframe.zip / enhwin.c < prev    next >
Text File  |  1995-08-07  |  3KB  |  83 lines

  1. /**************************************
  2.  
  3. Dan Akselrod (c) 1995.
  4.  
  5. Sample program. Calls enhframe module to add enhanced features to
  6. it's frame.
  7.  
  8. **************************************/
  9. #define INCL_WIN
  10. #define INCL_DOS
  11. #include <os2.h>
  12. #include "enhframe.h"
  13.  
  14. HAB hab;
  15. MRESULT EXPENTRY EnhWindProc(HWND, unsigned long, MPARAM, MPARAM);
  16.  
  17.  
  18. main() {
  19. HMQ hmq;
  20. QMSG qmsg;
  21. HWND hwnd, hwndFrame;
  22. unsigned long flCreate= \
  23.                 FCF_TITLEBAR | FCF_TASKLIST | FCF_SIZEBORDER |
  24.                 FCF_SHELLPOSITION | FCF_SYSMENU | FCF_MINMAX | FCF_AUTOICON;
  25.  
  26.         hab=WinInitialize(0);
  27.         hmq=WinCreateMsgQueue(hab, 0);
  28.  
  29.         WinRegisterClass(hab, "PMEnhancements", (PFNWP) EnhWindProc, WS_SYNCPAINT, 0);
  30.         hwndFrame=WinCreateStdWindow(
  31.                 HWND_DESKTOP,        //parent
  32.                 WS_VISIBLE | WS_SYNCPAINT,          //style
  33.                 &flCreate,           //create flags
  34.                 "PMEnhancements",    //class of client
  35.                 "Enhancements of a PM window",//title
  36.                 0,                   //Client style
  37.                 0,                   //resourses (in .EXE)
  38.                 1,                   //resourse id for the window
  39.                 &hwnd);
  40.  
  41.         EnhanceFrame(hwndFrame);
  42.  
  43.                 while (WinGetMsg(hab, &qmsg, 0, 0, 0))
  44.                         WinDispatchMsg(hab, &qmsg);
  45. return 0;
  46. }
  47.  
  48.  
  49.  
  50.  
  51. MRESULT EXPENTRY EnhWindProc(HWND hwnd, unsigned long msg, MPARAM mp1, MPARAM mp2) {
  52. HPS hps;
  53.         switch (msg) {
  54.         case WM_ERASEBACKGROUND:
  55.            return (MRESULT)TRUE;
  56.         case WM_SIZE:
  57.            WinInvalidateRect(WinQueryWindow(hwnd, QW_PARENT), NULL, TRUE);
  58.            return 0;
  59.         case WM_PAINT: {
  60.                    RECTL rectl;
  61.                    POINTL pointl;
  62.                    hps=WinBeginPaint(hwnd, NULLHANDLE, NULLHANDLE);
  63.                    WinQueryWindowRect(hwnd, &rectl);
  64.  
  65.                    pointl.x=rectl.xLeft;pointl.y=rectl.yBottom;
  66.                    GpiMove(hps, &pointl);
  67.                    pointl.x=rectl.xRight;pointl.y=rectl.yTop;
  68.                    GpiLine(hps, &pointl);
  69.  
  70.                    pointl.x=rectl.xRight;pointl.y=rectl.yBottom;
  71.                    GpiMove(hps, &pointl);
  72.                    pointl.x=rectl.xLeft;pointl.y=rectl.yTop;
  73.                    GpiLine(hps, &pointl);
  74.  
  75.                    WinDrawText(hps,-1 ,"Cool PM Stuff", &rectl, CLR_BLACK, 0,
  76.                                 DT_CENTER | DT_VCENTER );
  77.                    WinEndPaint(hps);
  78.                    return 0;
  79.            }
  80.         }
  81.         return WinDefWindowProc(hwnd, msg, mp1, mp2);
  82. }
  83.