opencv/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/dllmain.cpp

59 lines
1.7 KiB
C++
Raw Normal View History

//////////////////////////////////////////////////////////////////////////
//
// 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 {
2013-08-21 22:52:15 +08:00
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()
{
2013-08-21 20:44:09 +08:00
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 );
}