pEpCOMServerAdapter.cpp
author Volker Birk <vb@pep-project.org>
Sun, 19 Jun 2016 08:20:37 +0200
changeset 90 1328c5a129ea
parent 89 56b26b1c4f3b
child 91 0cddbdb0973f
permissions -rw-r--r--
adding HRESULT code
     1 // pEpCOMServerAdapter.cpp : Implementation of WinMain
     2 
     3 
     4 #include "stdafx.h"
     5 #include "resource.h"
     6 #include "pEpCOMServerAdapter_i.h"
     7 #include "xdlldata.h"
     8 
     9 #include "GateKeeper.h"
    10 
    11 using namespace ATL;
    12 using namespace std;
    13 
    14 class CpEpCOMServerAdapterModule : public ATL::CAtlExeModuleT< CpEpCOMServerAdapterModule >
    15 {
    16 public:
    17     HRESULT PreMessageLoop(int nShowCmd)
    18     {
    19         HRESULT result = ATL::CAtlExeModuleT< CpEpCOMServerAdapterModule >::PreMessageLoop(nShowCmd);
    20         assert(result == S_OK);
    21         if (result != S_OK)
    22             return result;
    23 
    24         gatekeeper_thread = new thread(gatekeeper, this);
    25         gatekeeper_thread->detach();
    26 
    27         return S_OK;
    28     }
    29 
    30 	DECLARE_LIBID(LIBID_pEpCOMServerAdapterLib)
    31 	DECLARE_REGISTRY_APPID_RESOURCEID(IDR_PEPCOMSERVERADAPTER, "{B3480081-82C0-4EE4-9AA1-3F513C9D78DD}")
    32 
    33 protected:
    34     static void gatekeeper(CpEpCOMServerAdapterModule * const self);
    35 
    36 private:
    37     thread *gatekeeper_thread;
    38 };
    39 
    40 void CpEpCOMServerAdapterModule::gatekeeper(CpEpCOMServerAdapterModule * const self)
    41 {
    42     GateKeeper keeper(self);
    43     keeper.keep();
    44 }
    45 
    46 CpEpCOMServerAdapterModule _AtlModule;
    47 
    48 //
    49 extern "C" int WINAPI _tWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, 
    50 								LPTSTR /*lpCmdLine*/, int nShowCmd)
    51 {
    52     return _AtlModule.WinMain(nShowCmd);
    53 }
    54