home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / src / app3ds.cpp < prev    next >
C/C++ Source or Header  |  1998-06-16  |  3KB  |  80 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #include "stdafx.h"
  12.  
  13. #ifdef AFX_INIT_SEG
  14. #pragma code_seg(AFX_INIT_SEG)
  15. #endif
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. #ifndef _AFX_NO_CTL3D_SUPPORT
  23.  
  24. #include "ctl3d.h"
  25. #pragma comment(lib, "ctl3d32s.lib")
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Support for CTL3D32.LIB (3D controls static library)
  29.  
  30. BOOL CWinApp::Enable3dControlsStatic()
  31. {
  32.     ASSERT(!afxContextIsDLL);   // Should only be called by apps
  33.  
  34.     // 3d controls and dialogs are automatic on newer versions of Windows
  35.     if (afxData.bWin4)
  36.         return TRUE;
  37.  
  38.     // otherwise, attempt to load CTL3D32.DLL
  39.     _AFX_CTL3D_STATE* pCtl3dState = _afxCtl3dState;
  40.     if (!pCtl3dState->m_bCtl3dInited)
  41.     {
  42.         // get address of Ctl3d functions
  43.         pCtl3dState->m_pfnRegister = &Ctl3dRegister;
  44.         pCtl3dState->m_pfnUnregister = &Ctl3dUnregister;
  45.         pCtl3dState->m_pfnAutoSubclass = &Ctl3dAutoSubclass;
  46.         pCtl3dState->m_pfnUnAutoSubclass = &Ctl3dUnAutoSubclass;
  47.         pCtl3dState->m_pfnColorChange = &Ctl3dColorChange;
  48.         pCtl3dState->m_pfnSubclassDlgEx = &Ctl3dSubclassDlgEx;
  49.         pCtl3dState->m_pfnWinIniChange = &Ctl3dWinIniChange;
  50.         pCtl3dState->m_pfnSubclassCtl = &Ctl3dSubclassCtl;
  51.         pCtl3dState->m_pfnSubclassCtlEx = &Ctl3dSubclassCtlEx;
  52.  
  53.         // may be incorrect version -- check for errors
  54.         if (!pCtl3dState->m_pfnRegister(AfxGetInstanceHandle()))
  55.         {
  56.             // don't want to be partially initialized
  57.             pCtl3dState->m_pfnRegister = NULL;
  58.             pCtl3dState->m_pfnUnregister = NULL;
  59.             pCtl3dState->m_pfnAutoSubclass = NULL;
  60.             pCtl3dState->m_pfnUnAutoSubclass = NULL;
  61.             pCtl3dState->m_pfnColorChange = NULL;
  62.             pCtl3dState->m_pfnSubclassDlgEx = NULL;
  63.             pCtl3dState->m_pfnWinIniChange = NULL;
  64.             pCtl3dState->m_pfnSubclassCtl = NULL;
  65.             pCtl3dState->m_pfnSubclassCtlEx = NULL;
  66.         }
  67.         pCtl3dState->m_bCtl3dInited = TRUE;
  68.     }
  69.  
  70.     if (pCtl3dState->m_pfnAutoSubclass == NULL)
  71.         return FALSE;
  72.  
  73.     // turn on auto subclassing (for primary thread)
  74.     return (*pCtl3dState->m_pfnAutoSubclass)(AfxGetInstanceHandle());
  75. }
  76.  
  77. #endif //!_AFX_NO_CTL3D_SUPPORT
  78.  
  79. /////////////////////////////////////////////////////////////////////////////
  80.