1
0

OnlineMediaCOM.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #include "main.h"
  2. #include "OnlineMediaCOM.h"
  3. #include "RatingsCOM.h"
  4. RatingsCOM ratingsCOM;
  5. enum
  6. {
  7. DISP_RATINGS = 0,
  8. };
  9. #define CHECK_ID(str, id) if (wcscmp(rgszNames[i], L##str) == 0) { rgdispid[i] = id; continue; }
  10. HRESULT OnlineMediaCOM::GetIDsOfNames(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid)
  11. {
  12. bool unknowns = false;
  13. for (unsigned int i = 0;i != cNames;i++)
  14. {
  15. CHECK_ID("Ratings", DISP_RATINGS)
  16. rgdispid[i] = DISPID_UNKNOWN;
  17. unknowns = true;
  18. }
  19. if (unknowns)
  20. return DISP_E_UNKNOWNNAME;
  21. else
  22. return S_OK;
  23. }
  24. HRESULT OnlineMediaCOM::GetTypeInfo(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo)
  25. {
  26. return E_NOTIMPL;
  27. }
  28. HRESULT OnlineMediaCOM::GetTypeInfoCount(unsigned int FAR * pctinfo)
  29. {
  30. return E_NOTIMPL;
  31. }
  32. HRESULT OnlineMediaCOM::Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr)
  33. {
  34. switch (dispid)
  35. {
  36. case DISP_RATINGS:
  37. VariantInit(pvarResult);
  38. V_VT(pvarResult) = VT_DISPATCH;
  39. V_DISPATCH(pvarResult) = &ratingsCOM;
  40. return S_OK;
  41. }
  42. return DISP_E_MEMBERNOTFOUND;
  43. }
  44. STDMETHODIMP OnlineMediaCOM::QueryInterface(REFIID riid, PVOID *ppvObject)
  45. {
  46. if (!ppvObject)
  47. return E_POINTER;
  48. else if (IsEqualIID(riid, IID_IDispatch))
  49. *ppvObject = (IDispatch *)this;
  50. else if (IsEqualIID(riid, IID_IUnknown))
  51. *ppvObject = this;
  52. else
  53. {
  54. *ppvObject = NULL;
  55. return E_NOINTERFACE;
  56. }
  57. AddRef();
  58. return S_OK;
  59. }
  60. ULONG OnlineMediaCOM::AddRef(void)
  61. {
  62. return 0;
  63. }
  64. ULONG OnlineMediaCOM::Release(void)
  65. {
  66. return 0;
  67. }