source: branches/erasershellext/cpp/Dll_Main.cpp @ 693

Revision 693, 2.0 KB checked in by lowjoel, 6 years ago (diff)

Case changing renames.

Line 
1// dllmain.cpp : Implementation of DllMain.
2
3#include "stdafx.h"
4#include "resource.h"
5#include "EraserCtxMenu_i.h"
6#include "dllmain.h"
7
8CEraserCtxMenuModule _AtlModule;
9CEraserCtxMenuApp theApp;
10BEGIN_MESSAGE_MAP(CEraserCtxMenuApp, CWinApp)
11END_MESSAGE_MAP()
12
13BOOL CEraserCtxMenuApp::InitInstance()
14{
15    return CWinApp::InitInstance();
16}
17
18int CEraserCtxMenuApp::ExitInstance()
19{
20    return CWinApp::ExitInstance();
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
30STDAPI 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
38STDAPI 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
45STDAPI 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
54STDAPI 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.   
62STDAPI 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}
Note: See TracBrowser for help on using the repository browser.