source: trunk/Utilities/Miscellaneous/RegFreeComPictureDisp/Server/Foo.h @ 793

Last change on this file since 793 was 793, checked in by roman, 5 years ago
  • Property svn:mime-type set to application/octet-stream
File size: 3.3 KB
Line 
1// Foo.h : Declaration of the CFoo
2
3#pragma once
4
5#include <atlstr.h>
6#include "resource.h"       // main symbols
7#include "Server_i.h"
8
9#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
10        #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."
11#endif
12
13using namespace ATL;
14
15// CFoo
16
17class ATL_NO_VTABLE CFoo :
18        public CComObjectRootEx<CComSingleThreadModel>,
19        public CComCoClass<CFoo, &CLSID_Foo>,
20        public IDispatchImpl<IFoo, &IID_IFoo, &LIBID_ServerLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
21{
22public:
23        CFoo()
24        {
25        }
26
27DECLARE_REGISTRY_RESOURCEID(106)
28
29
30BEGIN_COM_MAP(CFoo)
31        COM_INTERFACE_ENTRY(IFoo)
32        COM_INTERFACE_ENTRY(IDispatch)
33END_COM_MAP()
34
35
36
37        DECLARE_PROTECT_FINAL_CONSTRUCT()
38
39        HRESULT FinalConstruct()
40        {
41                return S_OK;
42        }
43
44        void FinalRelease()
45        {
46        }
47
48public:
49
50
51        STDMETHOD(Init)(BSTR User, BSTR Password) override
52        {
53                ATLTRACE(_T("User \"%s\", Password \"%s\"\n"), CString(User), CString(Password));
54                return S_OK;
55        }
56        STDMETHOD(SetBitmap)(BSTR szObjectType, IPictureDisp* szBitmap) override
57        {
58                ATLTRACE(_T("szObjectType \"%s\", szBitmap 0x%p\n"), CString(szObjectType), szBitmap);
59                return S_OK;
60        }
61
62};
63
64OBJECT_ENTRY_AUTO(__uuidof(Foo), CFoo)
Note: See TracBrowser for help on using the repository browser.