GME
13
|
00001 // GMEView.cpp : Implementation of CGMEViewApp and DLL registration. 00002 00003 #include "stdafx.h" 00004 #include "GMEView.h" 00005 00006 #ifdef _DEBUG 00007 #define new DEBUG_NEW 00008 #endif 00009 00010 00011 CGMEViewApp NEAR theApp; 00012 00013 const GUID CDECL BASED_CODE _tlid = 00014 { 0xE8F51618, 0x624F, 0x41D6, { 0xB3, 0x8F, 0x1, 0xC8, 0x1, 0x82, 0xAE, 0xDC } }; 00015 const WORD _wVerMajor = 1; 00016 const WORD _wVerMinor = 0; 00017 00018 00019 00020 // CGMEViewApp::InitInstance - DLL initialization 00021 00022 BOOL CGMEViewApp::InitInstance() 00023 { 00024 #if _MSC_VER < 1700 00025 // See MSDN example code for CWinApp::InitInstance: http://msdn.microsoft.com/en-us/library/ae6yx0z0.aspx 00026 // MFC module state handling code is changed with VC80. 00027 // We follow the Microsoft's suggested way, but in case of any trouble the set the 00028 // HKCU\Software\GME\AfxSetAmbientActCtxMod key to 0 00029 UINT uAfxSetAmbientActCtxMod = 1; 00030 HKEY hKey; 00031 if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\GME\\"), 00032 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) 00033 { 00034 TCHAR szData[128]; 00035 DWORD dwKeyDataType; 00036 DWORD dwDataBufSize = sizeof(szData)/sizeof(TCHAR); 00037 00038 if (RegQueryValueEx(hKey, _T("AfxSetAmbientActCtxMod"), NULL, &dwKeyDataType, 00039 (LPBYTE) &szData, &dwDataBufSize) == ERROR_SUCCESS) 00040 { 00041 uAfxSetAmbientActCtxMod = _tcstoul(szData, NULL, 10); 00042 } 00043 00044 RegCloseKey(hKey); 00045 } 00046 if (uAfxSetAmbientActCtxMod != 0) 00047 { 00048 AfxSetAmbientActCtx(FALSE); 00049 } 00050 #endif 00051 00052 BOOL bInit = COleControlModule::InitInstance(); 00053 00054 if (bInit) 00055 { 00056 // TODO: Add your own module initialization code here. 00057 } 00058 00059 return bInit; 00060 } 00061 00062 00063 00064 // CGMEViewApp::ExitInstance - DLL termination 00065 00066 int CGMEViewApp::ExitInstance() 00067 { 00068 // TODO: Add your own module termination code here. 00069 00070 return COleControlModule::ExitInstance(); 00071 } 00072 00073 00074 00075 // DllRegisterServer - Adds entries to the system registry 00076 00077 STDAPI DllRegisterServer(void) 00078 { 00079 AFX_MANAGE_STATE(_afxModuleAddrThis); 00080 00081 if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid)) 00082 return ResultFromScode(SELFREG_E_TYPELIB); 00083 00084 if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE)) 00085 return ResultFromScode(SELFREG_E_CLASS); 00086 00087 return NOERROR; 00088 } 00089 00090 00091 00092 // DllUnregisterServer - Removes entries from the system registry 00093 00094 STDAPI DllUnregisterServer(void) 00095 { 00096 AFX_MANAGE_STATE(_afxModuleAddrThis); 00097 00098 if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor)) 00099 return ResultFromScode(SELFREG_E_TYPELIB); 00100 00101 if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE)) 00102 return ResultFromScode(SELFREG_E_CLASS); 00103 00104 return NOERROR; 00105 }