Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cOleFlashHelper.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_cOleFlashHelper_H
6 #define _INC_cOleFlashHelper_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 #include "cOleFlash.h"
11 
12 #if defined(_WIN32) && defined(_MSC_VER) && defined(USE_FLASH)
13 #include "../WinAPI/cComConnectionPoint.h"
14 
15 #if 1
16 // NOTE: Adobe Flash must be installed for this COM object to work.
17 // #import "PROGID:ShockwaveFlash.ShockwaveFlash" no_namespace raw_interfaces_only
18 // #import "c:\\windows\\system32\\macromed\\flash\\flash.ocx" // 64 bit?
19 #import "Flash.tlb" raw_interfaces_only // 64 bit?
20 #define LIBID_ShockwaveFlashObjects __uuidof(__ShockwaveFlashObjects)
21 #else
22 #include <DispEx.h> // ICanHandleException
23 #include "Flash.h"
24 #endif
25 using namespace ShockwaveFlashObjects; // NOT no_namespace
26 
27 namespace GrayLib
28 {
29  class GRAYLIB_LINK cOleFlashHelper
30  : public cComConnectionPoint
31  , public _IShockwaveFlashEvents
32  , public ICanHandleException
33  {
38 
39  typedef cComConnectionPoint SUPER_t;
40 
41  protected:
42  cOleFlash* m_pFlashControlParent; // my parent. (non ref dumb pointer)
43 
44  protected:
45  HRESULT FlashCallXML(cOleFlashCall& flashcall, VARIANT __RPC_FAR *pVarResult);
46  HRESULT FlashCallRet(BSTR request, VARIANT __RPC_FAR *pVarResult);
47 
48  public:
49  cOleFlashHelper(cOleFlash* pFlashControlParent)
50  : cComConnectionPoint(static_cast<_IShockwaveFlashEvents*>(this), LIBID_ShockwaveFlashObjects, __uuidof(_IShockwaveFlashEvents))
51  , m_pFlashControlParent(pFlashControlParent)
52  {
53  ASSERT(pFlashControlParent);
54  }
55  virtual ~cOleFlashHelper()
56  {
57  }
58 
59  IUNKNOWN_DISAMBIG_R(cRefBase);
60  IDISPATCH_DISAMBIG_R(cComDispatch);
61 
62  virtual bool isDisposed() const
63  {
64  return m_pFlashControlParent == nullptr;
65  }
66  virtual HRESULT DisposeThis()
67  {
68  m_pFlashControlParent = nullptr;
69  HRESULT hRes = SUPER_t::DisposeThis();
70  return hRes;
71  }
72 
73  STDMETHOD(QueryInterface)(REFIID riid, LPVOID* ppv);
74 
75  // IDispatch method
76 
77  virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
78  WORD wFlags, ::DISPPARAMS __RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult,
79  ::EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr) override;
80 
81  // _IShockwaveFlashEvents - NOTE: HRESULT return should be void ??
82  // http://www.codeguru.com/forum/archive/index.php/t-420425.html
83  virtual void STDMETHODCALLTYPE OnReadyStateChange(long newState); // dispIdMember = 0xfffffd9f = DISPID_READYSTATECHANGE
84  virtual void STDMETHODCALLTYPE OnProgress(long percentDone); // dispIdMember = 0x7a6
85  virtual void STDMETHODCALLTYPE FSCommand(BSTR pwCommand, BSTR pwArgs); // dispIdMember = 0x96
86  virtual void STDMETHODCALLTYPE FlashCall(BSTR request); // dispIdMember = 0xC5
87 
88  // override ICanHandleException
89  STDMETHOD(CanHandleException)( /*[in]*/ ::EXCEPINFO * pExcepInfo, /*[in]*/ VARIANT * pvar) override;
90  };
91 }
92 
93 #endif
94 #endif
EXTERN_C const IID LIBID_ShockwaveFlashObjects
Definition: Flash_h.h:156
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define IUNKNOWN_DISAMBIG_R(TYPE)
Definition: IUnknown.h:85
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define ASSERT(exp)
Definition: cDebugAssert.h:87
Definition: cMesh.h:22
Definition: Flash.IDL:16