BrowserCOM.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /** (c) Nullsoft, Inc. C O N F I D E N T I A L
  2. ** Filename:
  3. ** Project:
  4. ** Description:
  5. ** Author: Ben Allison [email protected]
  6. ** Created:
  7. **/
  8. #include "main.h"
  9. #include "BrowserCOM.h"
  10. #include "Browser.h"
  11. #include "../nu/AutoChar.h"
  12. //extern Browser *browser;
  13. extern UpdateBrowser *updateBrowser;
  14. enum
  15. {
  16. DISP_BROWSER_SETSIZE = 777,
  17. DISP_BROWSER_SETTITLE,
  18. DISP_BROWSER_SETUPDATESIZE,
  19. DISP_BROWSER_HIDDEN,
  20. };
  21. #define CHECK_ID(str, id) if (wcscmp(rgszNames[i], L##str) == 0) { rgdispid[i] = id; continue; }
  22. HRESULT BrowserCOM::GetIDsOfNames(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid)
  23. {
  24. bool unknowns = false;
  25. for (unsigned int i = 0;i != cNames;i++)
  26. {
  27. //CHECK_ID("SetSize", DISP_BROWSER_SETSIZE)
  28. CHECK_ID("SetUpdateSize", DISP_BROWSER_SETUPDATESIZE)
  29. //CHECK_ID("SetTitle", DISP_BROWSER_SETTITLE)
  30. //CHECK_ID("hidden", DISP_BROWSER_HIDDEN)
  31. rgdispid[i] = DISPID_UNKNOWN;
  32. unknowns = true;
  33. }
  34. if (unknowns)
  35. return DISP_E_UNKNOWNNAME;
  36. else
  37. return S_OK;
  38. }
  39. HRESULT BrowserCOM::GetTypeInfo(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo)
  40. {
  41. return E_NOTIMPL;
  42. }
  43. HRESULT BrowserCOM::GetTypeInfoCount(unsigned int FAR * pctinfo)
  44. {
  45. return E_NOTIMPL;
  46. }
  47. HRESULT BrowserCOM::Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr)
  48. {
  49. switch (dispid)
  50. {
  51. case DISP_BROWSER_SETUPDATESIZE:
  52. if (pdispparams->cArgs == 2 && updateBrowser)
  53. {
  54. updateBrowser->Resized(pdispparams->rgvarg[1].lVal, pdispparams->rgvarg[0].lVal);
  55. return S_OK;
  56. }
  57. break;
  58. }
  59. return DISP_E_MEMBERNOTFOUND;
  60. }
  61. STDMETHODIMP BrowserCOM::QueryInterface(REFIID riid, PVOID *ppvObject)
  62. {
  63. if (!ppvObject)
  64. return E_POINTER;
  65. else if (IsEqualIID(riid, IID_IDispatch))
  66. *ppvObject = (IDispatch *)this;
  67. else if (IsEqualIID(riid, IID_IUnknown))
  68. *ppvObject = this;
  69. else
  70. {
  71. *ppvObject = NULL;
  72. return E_NOINTERFACE;
  73. }
  74. AddRef();
  75. return S_OK;
  76. }
  77. ULONG BrowserCOM::AddRef(void)
  78. {
  79. return 0;
  80. }
  81. ULONG BrowserCOM::Release(void)
  82. {
  83. return 0;
  84. }