Line | |
---|
1 | // Foo.h : Declaration of the CFoo |
---|
2 | |
---|
3 | #pragma once |
---|
4 | #include "resource.h" // main symbols |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | #include "Host_i.h" |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) |
---|
13 | #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." |
---|
14 | #endif |
---|
15 | |
---|
16 | using namespace ATL; |
---|
17 | |
---|
18 | |
---|
19 | // CFoo |
---|
20 | |
---|
21 | class ATL_NO_VTABLE CFoo : |
---|
22 | public CComObjectRootEx<CComSingleThreadModel>, |
---|
23 | public CComCoClass<CFoo, &CLSID_Foo>, |
---|
24 | public IDispatchImpl<IFoo, &IID_IFoo, &LIBID_HostLib, /*wMajor =*/ 1, /*wMinor =*/ 0> |
---|
25 | { |
---|
26 | public: |
---|
27 | CFoo() |
---|
28 | { |
---|
29 | } |
---|
30 | |
---|
31 | DECLARE_REGISTRY_RESOURCEID(IDR_FOO) |
---|
32 | |
---|
33 | |
---|
34 | BEGIN_COM_MAP(CFoo) |
---|
35 | COM_INTERFACE_ENTRY(IFoo) |
---|
36 | COM_INTERFACE_ENTRY(IDispatch) |
---|
37 | END_COM_MAP() |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | DECLARE_PROTECT_FINAL_CONSTRUCT() |
---|
42 | |
---|
43 | HRESULT FinalConstruct() |
---|
44 | { |
---|
45 | return S_OK; |
---|
46 | } |
---|
47 | |
---|
48 | void FinalRelease() |
---|
49 | { |
---|
50 | } |
---|
51 | |
---|
52 | public: |
---|
53 | |
---|
54 | // IFoo |
---|
55 | STDMETHOD(Bar)() |
---|
56 | { |
---|
57 | MessageBox(GetActiveWindow(), _T("Hello, 32-bit World!"), _T("Information"), MB_OK); |
---|
58 | return S_OK; |
---|
59 | } |
---|
60 | |
---|
61 | }; |
---|
62 | |
---|
63 | OBJECT_ENTRY_AUTO(__uuidof(Foo), CFoo) |
---|
Note: See
TracBrowser
for help on using the repository browser.