mirror of
https://github.com/opencv/opencv.git
synced 2024-12-27 11:28:14 +08:00
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
//////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// dllmain.cpp
|
|
//
|
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
|
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
|
// PARTICULAR PURPOSE.
|
|
//
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
#include <initguid.h>
|
|
#include "OcvTransform.h"
|
|
|
|
using namespace Microsoft::WRL;
|
|
|
|
namespace Microsoft { namespace Samples {
|
|
ActivatableClass(OcvImageManipulations);
|
|
}}
|
|
|
|
BOOL WINAPI DllMain( _In_ HINSTANCE hInstance, _In_ DWORD dwReason, _In_opt_ LPVOID lpReserved )
|
|
{
|
|
if( DLL_PROCESS_ATTACH == dwReason )
|
|
{
|
|
//
|
|
// Don't need per-thread callbacks
|
|
//
|
|
DisableThreadLibraryCalls( hInstance );
|
|
|
|
Module<InProc>::GetModule().Create();
|
|
}
|
|
else if( DLL_PROCESS_DETACH == dwReason )
|
|
{
|
|
Module<InProc>::GetModule().Terminate();
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
HRESULT WINAPI DllGetActivationFactory( _In_ HSTRING activatibleClassId, _Outptr_ IActivationFactory** factory )
|
|
{
|
|
auto &module = Microsoft::WRL::Module< Microsoft::WRL::InProc >::GetModule();
|
|
return module.GetActivationFactory( activatibleClassId, factory );
|
|
}
|
|
|
|
HRESULT WINAPI DllCanUnloadNow()
|
|
{
|
|
auto &module = Microsoft::WRL::Module<Microsoft::WRL::InProc>::GetModule();
|
|
return (module.Terminate()) ? S_OK : S_FALSE;
|
|
}
|
|
|
|
STDAPI DllGetClassObject( _In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv )
|
|
{
|
|
auto &module = Microsoft::WRL::Module<Microsoft::WRL::InProc>::GetModule();
|
|
return module.GetClassObject( rclsid, riid, ppv );
|
|
}
|