home *** CD-ROM | disk | FTP | other *** search
/ Supercompiler 1997 / SUPERCOMPILER97.iso / MS_VC.50 / VC / MFC / SRC / APPMODUL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-30  |  2.2 KB  |  87 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1997 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 _DEBUG
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // export WinMain to force linkage to this module
  20.  
  21. extern int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  22.     LPTSTR lpCmdLine, int nCmdShow);
  23.  
  24. #ifdef _MAC
  25. extern "C" int PASCAL
  26. #else
  27. extern "C" int WINAPI
  28. #endif
  29. _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  30.     LPTSTR lpCmdLine, int nCmdShow)
  31. {
  32.     // call shared/exported WinMain
  33.     return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
  34. }
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // initialize app state such that it points to this module's core state
  38.  
  39. BOOL AFXAPI AfxInitialize(BOOL bDLL, DWORD dwVersion)
  40. {
  41.     AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
  42.     pModuleState->m_bDLL = (BYTE)bDLL;
  43.     ASSERT(dwVersion <= _MFC_VER);
  44.     UNUSED(dwVersion);  // not used in release build
  45. #ifdef _AFXDLL
  46.     pModuleState->m_dwVersion = dwVersion;
  47. #endif
  48. #ifndef _MAC
  49. #ifdef _MBCS
  50.     // set correct multi-byte code-page for Win32 apps
  51.     if (!bDLL)
  52.         _setmbcp(_MB_CP_ANSI);
  53. #endif //_MBCS
  54. #endif //!_MAC
  55.     return TRUE;
  56. }
  57.  
  58. class _AFX_TERM_APP_STATE
  59. {
  60. public:
  61.     _AFX_TERM_APP_STATE();
  62. #ifndef _AFXDLL
  63.     ~_AFX_TERM_APP_STATE();
  64. #endif
  65. };
  66.  
  67. _AFX_TERM_APP_STATE::_AFX_TERM_APP_STATE()
  68. {
  69.     // initialize this module as an application
  70.     AfxInitialize(FALSE, _MFC_VER);
  71. }
  72.  
  73. #ifndef _AFXDLL
  74. _AFX_TERM_APP_STATE::~_AFX_TERM_APP_STATE()
  75. {
  76.     AfxTermLocalData(NULL, TRUE);
  77. }
  78. #endif
  79.  
  80. // force initialization early
  81. #pragma warning(disable: 4074)
  82. #pragma init_seg(lib)
  83.  
  84. _AFX_TERM_APP_STATE _afxTermAppState;
  85.  
  86. /////////////////////////////////////////////////////////////////////////////
  87.