home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 February / Chip_2001-02_cd1.bin / sharewar / vecad / examples / bcpp / editor / DgAbout.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-23  |  1.3 KB  |  54 lines

  1. /********************************************************************
  2. * Project: VeCAD ver.5.1
  3. * Copyright (C) 1999-2000 by Oleg Kolbaskin.
  4. * All rights reserved.
  5. *
  6. * Dialog "About"
  7. ********************************************************************/
  8. #include <windows.h>
  9. #include "vecres.h"
  10.   #pragma  hdrstop
  11.  
  12. extern HINSTANCE ghInst;     // app instance
  13.  
  14. static BOOL CALLBACK DlgProcAbout (HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
  15.  
  16.  
  17. //-----------------------------------------------
  18. int DlgAbout (HWND hw)
  19. {
  20.   int ret = DialogBox( ghInst, MAKEINTRESOURCE(DG_ABOUT), hw, (DLGPROC)DlgProcAbout );
  21.   return ret;
  22. }
  23.  
  24. #pragma argsused
  25. //-----------------------------------------------
  26. BOOL CALLBACK DlgProcAbout (HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
  27. {
  28.   RECT  rect;
  29.   POINT p;
  30.   switch (uMsg) {
  31.     case WM_INITDIALOG:
  32.       GetWindowRect( hDlg, &rect );
  33.       p.x = (GetSystemMetrics(SM_CXSCREEN)-(rect.right-rect.left))>>1;
  34.       p.y = (GetSystemMetrics(SM_CYSCREEN)-(rect.bottom-rect.top))>>1;
  35.       SetWindowPos( hDlg, HWND_TOP, p.x, p.y, 0,0, SWP_NOSIZE );
  36.       return TRUE;
  37.  
  38.     case WM_CLOSE:
  39.       EndDialog( hDlg, 0 );
  40.       break;
  41.  
  42.     case WM_COMMAND:
  43.       switch (LOWORD(wParam)) {
  44.         case IDOK:
  45.           EndDialog( hDlg, 1 );
  46.           break;
  47.       }
  48.       break;
  49.   }
  50.   return FALSE;
  51. }
  52.  
  53.  
  54.