PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 1ms

/Visual Studio 2008/CppExeCOMServer/SimpleObject.h

#
C++ Header | 60 lines | 26 code | 12 blank | 22 comment | 0 complexity | c89e579c4f236a387526b633d03e42d7 MD5 | raw file
 1/****************************** Module Header ******************************\
 2Module Name:  SimpleObject.h
 3Project:      CppExeCOMServer
 4Copyright (c) Microsoft Corporation.
 5
 6
 7
 8This source is subject to the Microsoft Public License.
 9See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
10All other rights reserved.
11
12THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
13EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
14WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
15\***************************************************************************/
16
17#pragma once
18
19#include <windows.h>
20#include "CppExeCOMServer_h.h"  // For ISimpleObject
21
22
23class SimpleObject : public ISimpleObject
24{
25public:
26    // IUnknown
27    IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv);
28    IFACEMETHODIMP_(ULONG) AddRef();
29    IFACEMETHODIMP_(ULONG) Release();
30
31    // IDispatch
32    IFACEMETHODIMP GetTypeInfoCount(UINT *pctinfo);
33    IFACEMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo);
34    IFACEMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid);
35    IFACEMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispParams, VARIANT *pvarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
36
37    // ISimpleObject
38    IFACEMETHODIMP get_FloatProperty(FLOAT *pVal);
39	IFACEMETHODIMP put_FloatProperty(FLOAT newVal);
40	IFACEMETHODIMP HelloWorld(BSTR *pRet);
41	IFACEMETHODIMP GetProcessThreadID(LONG *pdwProcessId, LONG *pdwThreadId);
42
43    SimpleObject();
44
45protected:
46    ~SimpleObject();
47
48private:
49    // Reference count of component.
50    long m_cRef;
51
52    // The value of FloatProperty.
53    float m_fField;
54
55    // Pointer to type-library (for implementing IDispatch).
56    LPTYPEINFO m_ptinfo;
57
58    // Helper function to load the type info (for implementing IDispatch).
59    HRESULT LoadTypeInfo(ITypeInfo **pptinfo, const CLSID& libid, const CLSID& iid, LCID lcid);
60};