pEpCOMServerAdapter.h
changeset 110 c643437f9b61
child 140 3975758c4320
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pEpCOMServerAdapter.h	Tue Jun 21 19:24:54 2016 +0200
     1.3 @@ -0,0 +1,44 @@
     1.4 +#include "stdafx.h"
     1.5 +
     1.6 +#include "pEpCOMServerAdapter_i.h"
     1.7 +
     1.8 +using namespace ATL;
     1.9 +using namespace std;
    1.10 +
    1.11 +class CpEpCOMServerAdapterModule : public ATL::CAtlExeModuleT< CpEpCOMServerAdapterModule > {
    1.12 +public:
    1.13 +    CpEpCOMServerAdapterModule() : ATL::CAtlExeModuleT< CpEpCOMServerAdapterModule >(), gatekeeper_thread(NULL), _hModule(NULL)
    1.14 +    {
    1.15 +    }
    1.16 +
    1.17 +    DECLARE_LIBID(LIBID_pEpCOMServerAdapterLib)
    1.18 +    DECLARE_REGISTRY_APPID_RESOURCEID(IDR_PEPCOMSERVERADAPTER, "{B3480081-82C0-4EE4-9AA1-3F513C9D78DD}")
    1.19 +
    1.20 +    HMODULE hModule()
    1.21 +    {
    1.22 +        return _hModule;
    1.23 +    }
    1.24 +
    1.25 +    void hModule(HMODULE m)
    1.26 +    {
    1.27 +        _hModule = m;
    1.28 +    }
    1.29 +
    1.30 +    void start_gatekeeper()
    1.31 +    {
    1.32 +        try {
    1.33 +            gatekeeper_thread = new thread(gatekeeper, this);
    1.34 +            gatekeeper_thread->detach();
    1.35 +        }
    1.36 +        catch (system_error&) {
    1.37 +
    1.38 +        }
    1.39 +    }
    1.40 +
    1.41 +protected:
    1.42 +    static void gatekeeper(CpEpCOMServerAdapterModule * self);
    1.43 +
    1.44 +private:
    1.45 +    thread *gatekeeper_thread;
    1.46 +    HMODULE _hModule;
    1.47 +};