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