home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / memsrc.zip / COMMON / about.c next >
C/C++ Source or Header  |  1999-07-05  |  3KB  |  88 lines

  1. /* --------------------------------------------------------------------
  2.                           About Dialog Handler
  3. -------------------------------------------------------------------- */
  4.  
  5. #define INCL_WIN
  6.  
  7. #include <os2.h>
  8. #include "about.h"
  9.  
  10. #define DB_RAISED       0x0400
  11. #define DB_DEPRESSED    0x0800
  12.  
  13. VOID DisplayAbout (HWND hWnd, PSZ pszAppName)
  14. {
  15.     WinDlgBox (HWND_DESKTOP, hWnd, AboutDlgProc, 0L, 10000, pszAppName);
  16.     return;
  17. }
  18.  
  19. /* ----------------------  Dialog Function ----------------------- */
  20.  
  21. MRESULT EXPENTRY AboutDlgProc (HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  22. {
  23.     BOOL    bHandled = TRUE;
  24.     MRESULT mReturn  = 0;
  25.     ULONG   ulScrWidth, ulScrHeight;
  26.     RECTL   Rectl;
  27.     SWP     Swp;
  28.     HPS     hps;
  29.  
  30.     switch (msg)
  31.     {           
  32.         case WM_INITDLG:
  33.             /* Center dialog on screen */
  34.             ulScrWidth  = WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN);
  35.             ulScrHeight = WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN);
  36.             WinQueryWindowRect (hWnd, &Rectl);
  37.             WinSetWindowPos (hWnd, HWND_TOP, (ulScrWidth-Rectl.xRight)/2,
  38.                 (ulScrHeight-Rectl.yTop)/2, 0, 0, SWP_MOVE | SWP_ACTIVATE);
  39.  
  40.             /* Set application title */
  41.             WinSetDlgItemText (hWnd, 10001, (PSZ)mp2);
  42.             break;
  43.  
  44.         case WM_PAINT:
  45.             hps = WinBeginPaint (hWnd,0,0);
  46.             WinQueryWindowRect (hWnd, &Rectl);
  47.             WinFillRect (hps, &Rectl, CLR_PALEGRAY);
  48.             WinDrawBorder (hps, &Rectl, 
  49.                 WinQuerySysValue(HWND_DESKTOP,SV_CXDLGFRAME), 
  50.                 WinQuerySysValue(HWND_DESKTOP,SV_CYDLGFRAME), 
  51.                 CLR_DARKGRAY, CLR_WHITE, DB_RAISED);
  52.             GpiMove (hps, (PPOINTL)&Rectl);
  53.             Rectl.xRight--;
  54.             Rectl.yTop--;
  55.             GpiBox (hps, DRO_OUTLINE, (PPOINTL)&Rectl.xRight, 0L, 0L);
  56.             WinQueryWindowPos (WinWindowFromID (hWnd, 10002), &Swp);
  57.             Rectl.xLeft   = Swp.x-1;
  58.             Rectl.yBottom = Swp.y-1;
  59.             Rectl.xRight  = Swp.x + Swp.cx + 1;
  60.             Rectl.yTop    = Swp.y + Swp.cy + 1;
  61.             WinDrawBorder (hps, &Rectl, 1L, 1L,
  62.                 CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED);
  63.             WinQueryWindowPos (WinWindowFromID (hWnd, 10003), &Swp);
  64.             Rectl.xLeft   = Swp.x-1;
  65.             Rectl.yBottom = Swp.y-1;
  66.             Rectl.xRight  = Swp.x + Swp.cx + 1;
  67.             Rectl.yTop    = Swp.y + Swp.cy + 1;
  68.             WinDrawBorder (hps, &Rectl, 1L, 1L,
  69.                 CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED);
  70.             WinEndPaint (hps);
  71.             break;
  72.  
  73.           case WM_COMMAND:
  74.             WinDismissDlg (hWnd, DID_OK);
  75.             break;
  76.  
  77.         default:
  78.             bHandled = FALSE;
  79.             break;
  80.     }
  81.  
  82.     if (!bHandled)
  83.         mReturn = WinDefDlgProc (hWnd, msg, mp1, mp2);
  84.  
  85.     return (mReturn);
  86. }
  87.  
  88.