Changeset 693
- Timestamp:
- 12/2/2008 10:10:19 AM (4 years ago)
- Location:
- branches/erasershellext/cpp
- Files:
-
- 2 moved
-
Dll_Main.cpp (moved) (moved from branches/erasershellext/cpp/dllmain.cpp) (2 diffs)
-
Dll_Main.h (moved) (moved from branches/erasershellext/cpp/dllmain.h) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/erasershellext/cpp/Dll_Main.cpp
r689 r693 8 8 CEraserCtxMenuModule _AtlModule; 9 9 CEraserCtxMenuApp theApp; 10 11 10 BEGIN_MESSAGE_MAP(CEraserCtxMenuApp, CWinApp) 12 11 END_MESSAGE_MAP() … … 21 20 return CWinApp::ExitInstance(); 22 21 } 22 23 24 #include "stdafx.h" 25 #include "resource.h" 26 #include "EraserCtxMenu_i.h" 27 #include "dllmain.h" 28 29 // Used to determine whether the DLL can be unloaded by OLE 30 STDAPI DllCanUnloadNow(void) 31 { 32 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 33 return (AfxDllCanUnloadNow()==S_OK && _AtlModule.GetLockCount()==0) ? S_OK : S_FALSE; 34 } 35 36 37 // Returns a class factory to create an object of the requested type 38 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) 39 { 40 return _AtlModule.DllGetClassObject(rclsid, riid, ppv); 41 } 42 43 44 // DllRegisterServer - Adds entries to the system registry 45 STDAPI DllRegisterServer(void) 46 { 47 // registers object, typelib and all interfaces in typelib 48 HRESULT hr = _AtlModule.DllRegisterServer(); 49 return hr; 50 } 51 52 53 // DllUnregisterServer - Removes entries from the system registry 54 STDAPI DllUnregisterServer(void) 55 { 56 HRESULT hr = _AtlModule.DllUnregisterServer(); 57 return hr; 58 } 59 60 // DllInstall - Adds/Removes entries to the system registry per user 61 // per machine. 62 STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine) 63 { 64 HRESULT hr = E_FAIL; 65 static const wchar_t szUserSwitch[] = _T("user"); 66 67 if (pszCmdLine != NULL) 68 { 69 if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0) 70 { 71 AtlSetPerUserRegistration(true); 72 } 73 } 74 75 if (bInstall) 76 { 77 hr = DllRegisterServer(); 78 if (FAILED(hr)) 79 { 80 DllUnregisterServer(); 81 } 82 } 83 else 84 { 85 hr = DllUnregisterServer(); 86 } 87 88 return hr; 89 } -
branches/erasershellext/cpp/Dll_Main.h
r689 r693 1 1 // dllmain.h : Declaration of module class. 2 #pragma once 2 3 3 4 class CEraserCtxMenuModule : public CAtlDllModuleT< CEraserCtxMenuModule >
Note: See TracChangeset
for help on using the changeset viewer.
