[79] | 1 | //////////////////////////////////////////////////////////// |
---|
| 2 | // Copyright (C) Roman Ryltsov, 2008-2012 |
---|
| 3 | // Created by Roman Ryltsov roman@alax.info |
---|
| 4 | // |
---|
| 5 | // $Id: Foo.h 81 2012-07-30 16:45:31Z roman $ |
---|
| 6 | |
---|
| 7 | #pragma once |
---|
| 8 | |
---|
| 9 | #include <atlstr.h> |
---|
| 10 | #include "VbsEvents_i.h" |
---|
| 11 | #include "_IFooEvents_CP.h" |
---|
| 12 | |
---|
| 13 | #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) |
---|
| 14 | #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." |
---|
| 15 | #endif |
---|
| 16 | |
---|
| 17 | using namespace ATL; |
---|
| 18 | |
---|
| 19 | //////////////////////////////////////////////////////////// |
---|
| 20 | // CFoo |
---|
| 21 | |
---|
| 22 | class ATL_NO_VTABLE CFoo : |
---|
| 23 | public CComObjectRootEx<CComSingleThreadModel>, |
---|
| 24 | public CComCoClass<CFoo, &CLSID_Foo>, |
---|
| 25 | public IConnectionPointContainerImpl<CFoo>, |
---|
| 26 | public CProxy_IFooEvents<CFoo>, |
---|
[81] | 27 | public IDispatchImpl<IFoo>, |
---|
[79] | 28 | public IProvideClassInfo2Impl<&__uuidof(Foo), &__uuidof(_IFooEvents)> |
---|
| 29 | { |
---|
| 30 | public: |
---|
| 31 | |
---|
| 32 | DECLARE_REGISTRY_RESOURCEID(IDR_FOO) |
---|
| 33 | |
---|
| 34 | DECLARE_PROTECT_FINAL_CONSTRUCT() |
---|
| 35 | |
---|
| 36 | BEGIN_COM_MAP(CFoo) |
---|
| 37 | COM_INTERFACE_ENTRY(IFoo) |
---|
| 38 | COM_INTERFACE_ENTRY(IDispatch) |
---|
| 39 | COM_INTERFACE_ENTRY(IConnectionPointContainer) |
---|
[81] | 40 | COM_INTERFACE_ENTRY(IProvideClassInfo2) |
---|
| 41 | COM_INTERFACE_ENTRY(IProvideClassInfo) |
---|
[79] | 42 | END_COM_MAP() |
---|
| 43 | |
---|
| 44 | BEGIN_CONNECTION_POINT_MAP(CFoo) |
---|
| 45 | CONNECTION_POINT_ENTRY(__uuidof(_IFooEvents)) |
---|
| 46 | END_CONNECTION_POINT_MAP() |
---|
| 47 | |
---|
| 48 | public: |
---|
| 49 | // CFoo |
---|
| 50 | CFoo() |
---|
| 51 | { |
---|
| 52 | ATLTRACE(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | // IFoo |
---|
| 56 | STDMETHOD(Method)(BSTR sText) throw() |
---|
| 57 | { |
---|
| 58 | ATLTRACE(atlTraceCOM, 4, _T("sText \"%s\"\n"), CString(sText)); |
---|
| 59 | ATLVERIFY(SUCCEEDED(Fire_Event(sText))); |
---|
| 60 | return S_OK; |
---|
| 61 | } |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | OBJECT_ENTRY_AUTO(__uuidof(Foo), CFoo) |
---|