1 // ExampleAtlPlugin.cpp : Implementation of DLL Exports.
\r
5 #include "resource.h"
\r
6 #include "ExampleAtlPlugin_i.h"
\r
9 // Used to determine whether the DLL can be unloaded by OLE
\r
10 STDAPI DllCanUnloadNow(void)
\r
12 return _AtlModule.DllCanUnloadNow();
\r
16 // Returns a class factory to create an object of the requested type
\r
17 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
\r
19 return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
\r
23 // DllRegisterServer - Adds entries to the system registry
\r
24 STDAPI DllRegisterServer(void)
\r
26 // registers object, typelib and all interfaces in typelib
\r
27 HRESULT hr = _AtlModule.DllRegisterServer();
\r
32 // DllUnregisterServer - Removes entries from the system registry
\r
33 STDAPI DllUnregisterServer(void)
\r
35 HRESULT hr = _AtlModule.DllUnregisterServer();
\r
39 // DllInstall - Adds/Removes entries to the system registry per user
\r
41 STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
\r
43 HRESULT hr = E_FAIL;
\r
44 static const wchar_t szUserSwitch[] = _T("user");
\r
46 if (pszCmdLine != NULL)
\r
48 if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
\r
50 AtlSetPerUserRegistration(true);
\r
56 hr = DllRegisterServer();
\r
59 DllUnregisterServer();
\r
64 hr = DllUnregisterServer();
\r