PageRenderTime 28ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

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