+//---------------------------------------------------------------------------
+// Pre-compiled header stuff
+//---------------------------------------------------------------------------
+
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
+#pragma implementation "mediactrl.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+//---------------------------------------------------------------------------
+// MediaCtrl include
+//---------------------------------------------------------------------------
+#include "wx/mediactrl.h"
+
+//---------------------------------------------------------------------------
+// Compilation guard
+//---------------------------------------------------------------------------
+#if wxUSE_MEDIACTRL
+
+//---------------------------------------------------------------------------
+// WX Includes
+//---------------------------------------------------------------------------
+#include "wx/log.h" //wxLogDebug
+#include "wx/math.h" //log10 & pow
+#include "wx/msw/private.h" //user info and wndproc setting/getting
+#include "wx/dcclient.h"
+#include "wx/timer.h"
+#include "wx/dynlib.h"
+
+//---------------------------------------------------------------------------
+// Externals (somewhere in src/msw/app.cpp and src/msw/window.cpp)
+//---------------------------------------------------------------------------
+extern "C" WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(void);
+#ifdef __WXWINCE__
+extern WXDLLIMPEXP_CORE wxChar *wxCanvasClassName;
+#else
+extern WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName;
+#endif
+
+LRESULT WXDLLIMPEXP_CORE APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+//===========================================================================
+// BACKEND DECLARATIONS
+//===========================================================================
+
+// ----------------------------------------------------------------------------
+// common backend base class used by all other backends
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_MEDIA wxMediaBackendCommonBase : public wxMediaBackend
+{
+public:
+ // add a pending wxMediaEvent of the given type
+ void QueueEvent(wxEventType evtType);
+
+ // notify that the movie playback is finished
+ void QueueFinishEvent() { QueueEvent(wxEVT_MEDIA_FINISHED); }
+
+ // send the stop event and return true if it hasn't been vetoed
+ bool SendStopEvent();
+
+protected:
+ // call this when the movie size has changed but not because it has just
+ // been loaded (in this case, call NotifyMovieLoaded() below)
+ void NotifyMovieSizeChanged();
+
+ // call this when the movie is fully loaded
+ void NotifyMovieLoaded();
+
+
+ wxControl *m_ctrl; // parent control
+};
+
+//---------------------------------------------------------------------------
+//
+// wxAMMediaBackend
+//
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+// COM includes
+//---------------------------------------------------------------------------
+#include "wx/msw/ole/oleutils.h" //wxBasicString, IID etc.
+#include "wx/msw/ole/uuid.h" //IID etc..
+#include <oleidl.h>
+#include <olectl.h>
+#include <exdisp.h>
+#include <docobj.h>
+
+//
+// These defines are from another ole header - but its not in the
+// latest sdk. Also the ifndef DISPID_READYSTATE is here because at
+// least on my machine with the latest sdk olectl.h defines these 3
+//
+#ifndef DISPID_READYSTATE
+ #define DISPID_READYSTATE -525
+ #define DISPID_READYSTATECHANGE -609
+ #define DISPID_AMBIENT_TRANSFERPRIORITY -728
+#endif
+
+#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED -5501
+#define DISPID_AMBIENT_SILENT -5502
+
+#ifndef DISPID_AMBIENT_CODEPAGE
+# define DISPID_AMBIENT_CODEPAGE -725
+# define DISPID_AMBIENT_CHARSET -727
+#endif
+
+//---------------------------------------------------------------------------
+// COM compatability definitions
+//---------------------------------------------------------------------------
+#ifndef STDMETHODCALLTYPE
+#define STDMETHODCALLTYPE __stdcall
+#endif
+#ifndef STDMETHOD
+#define STDMETHOD(funcname) virtual HRESULT STDMETHODCALLTYPE funcname
+#endif
+#ifndef PURE
+#define PURE = 0
+#endif
+#ifndef __RPC_FAR
+#define __RPC_FAR FAR
+#endif
+
+//---------------------------------------------------------------------------
+// IIDS - used by CoCreateInstance and IUnknown::QueryInterface
+//
+// [idl name] [idl decription]
+// amcompat.idl Microsoft Active Movie Control (Ver 2.0)
+// nscompat.idl Microsoft NetShow Player (Ver 1.0)
+// msdxm.idl Windows Media Player (Ver 1.0)
+// quartz.idl
+//
+// First, when I say I "from XXX.idl", I mean I go into the COM Browser
+// ($Microsoft Visual Studio$/Common/Tools/OLEVIEW.EXE), open
+// "type libraries", open a specific type library (for quartz for example its
+// "ActiveMovie control type library (V1.0)"), save it as an .idl, compile the
+// idl using the midl compiler that comes with visual studio
+// ($Microsoft Visual Studio$/VC98/bin/midl.exe on VC6) with the /h argument
+// to make it generate stubs (a .h & .c file), then clean up the generated
+// interfaces I want with the STDMETHOD wrappers and then put them into
+// mediactrl.cpp.
+//
+// According to the MSDN docs, IMediaPlayer requires Windows 98 SE
+// or greater. NetShow is available on Windows 3.1 and I'm guessing
+// IActiveMovie is too. IMediaPlayer is essentially the Windows Media
+// Player 6.4 SDK.
+//
+// Some of these are not used but are kept here for future reference anyway
+//---------------------------------------------------------------------------
+const IID IID_IActiveMovie = {0x05589FA2,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}};
+const IID IID_IActiveMovie2 = {0xB6CD6554,0xE9CB,0x11D0,{0x82,0x1F,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}};
+const IID IID_IActiveMovie3 = {0x265EC140,0xAE62,0x11D1,{0x85,0x00,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}};
+
+const IID IID_INSOPlay = {0x2179C5D1,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}};
+const IID IID_INSPlay = {0xE7C4BE80,0x7960,0x11D0,{0xB7,0x27,0x00,0xAA,0x00,0xB4,0xE2,0x20}};
+const IID IID_INSPlay1 = {0x265EC141,0xAE62,0x11D1,{0x85,0x00,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}};
+
+const IID IID_IMediaPlayer = {0x22D6F311,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}};
+const IID IID_IMediaPlayer2 = {0x20D4F5E0,0x5475,0x11D2,{0x97,0x74,0x00,0x00,0xF8,0x08,0x55,0xE6}};
+
+const CLSID CLSID_ActiveMovie = {0x05589FA1,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}};
+const CLSID CLSID_MediaPlayer = {0x22D6F312,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}};
+const CLSID CLSID_NSPlay = {0x2179C5D3,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}};
+
+const IID IID_IAMOpenProgress = {0x8E1C39A1, 0xDE53, 0x11CF,{0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D}};
+
+// QUARTZ
+const CLSID CLSID_FilgraphManager = {0xE436EBB3,0x524F,0x11CE,{0x9F,0x53,0x00,0x20,0xAF,0x0B,0xA7,0x70}};
+const IID IID_IMediaEvent = {0x56A868B6,0x0AD4,0x11CE,{0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70}};
+
+//?? QUARTZ Also?
+const CLSID CLSID_VideoMixingRenderer9 ={0x51B4ABF3, 0x748F, 0x4E3B,{0xA2, 0x76, 0xC8, 0x28, 0x33, 0x0E, 0x92, 0x6A}};
+const IID IID_IVMRWindowlessControl9 = {0x8F537D09, 0xF85E, 0x4414,{0xB2, 0x3B, 0x50, 0x2E, 0x54, 0xC7, 0x99, 0x27}};
+const IID IID_IFilterGraph = {0x56A8689F, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
+const IID IID_IGraphBuilder = {0x56A868A9, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
+const IID IID_IVMRFilterConfig9 = {0x5A804648, 0x4F66, 0x4867,{0x9C, 0x43, 0x4F, 0x5C, 0x82, 0x2C, 0xF1, 0xB8}};
+const IID IID_IBaseFilter = {0x56A86895, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
+
+//---------------------------------------------------------------------------
+// QUARTZ COM INTERFACES (dumped from quartz.idl from MSVC COM Browser)
+//---------------------------------------------------------------------------
+
+struct IAMOpenProgress : public IUnknown
+{
+ STDMETHOD(QueryProgress)(LONGLONG *pllTotal, LONGLONG *pllCurrent) PURE;
+ STDMETHOD(AbortOperation)(void) PURE;
+};
+
+struct IMediaEvent : public IDispatch
+{
+ STDMETHOD(GetEventHandle)(LONG_PTR *) PURE;
+ STDMETHOD(GetEvent)(long *, LONG_PTR *, LONG_PTR *, long) PURE;
+ STDMETHOD(WaitForCompletion)(long, long *) PURE;
+ STDMETHOD(CancelDefaultHandling)(long) PURE;
+ STDMETHOD(RestoreDefaultHandling)(long) PURE;
+ STDMETHOD(FreeEventParams)(long, LONG_PTR, LONG_PTR) PURE;
+};
+
+//---------------------------------------------------------------------------
+// ACTIVEMOVIE COM INTERFACES (dumped from amcompat.idl from MSVC COM Browser)
+//---------------------------------------------------------------------------
+
+enum ReadyStateConstants
+{
+ amvUninitialized = 0,
+ amvLoading = 1,
+ amvInteractive = 3,
+ amvComplete = 4
+};
+
+enum StateConstants
+{
+ amvNotLoaded = -1,
+ amvStopped = 0,
+ amvPaused = 1,
+ amvRunning = 2
+};
+
+enum DisplayModeConstants
+{
+ amvTime = 0,
+ amvFrames = 1
+};
+
+enum WindowSizeConstants
+{
+ amvOriginalSize = 0,
+ amvDoubleOriginalSize = 1,
+ amvOneSixteenthScreen = 2,
+ amvOneFourthScreen = 3,
+ amvOneHalfScreen = 4
+};
+
+enum AppearanceConstants
+{
+ amvFlat = 0,
+ amv3D = 1
+};
+
+enum BorderStyleConstants
+{
+ amvNone = 0,
+ amvFixedSingle = 1
+};
+
+struct IActiveMovie : public IDispatch
+{
+ STDMETHOD(AboutBox)( void) PURE;
+ STDMETHOD(Run)( void) PURE;
+ STDMETHOD(Pause)( void) PURE;
+ STDMETHOD(Stop)( void) PURE;
+ STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE;
+ STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE;
+ STDMETHOD(get_Author)(BSTR __RPC_FAR *pbstrAuthor) PURE;
+ STDMETHOD(get_Title)(BSTR __RPC_FAR *pbstrTitle) PURE;
+ STDMETHOD(get_Copyright)(BSTR __RPC_FAR *pbstrCopyright) PURE;
+ STDMETHOD(get_Description)(BSTR __RPC_FAR *pbstrDescription) PURE;
+ STDMETHOD(get_Rating)(BSTR __RPC_FAR *pbstrRating) PURE;
+ STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE;
+ STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE;
+ STDMETHOD(get_Duration)(double __RPC_FAR *pValue) PURE;
+ STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_CurrentPosition)(double pValue) PURE;
+ STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE;
+ STDMETHOD(put_PlayCount)(long pPlayCount) PURE;
+ STDMETHOD(get_SelectionStart)(double __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_SelectionStart)(double pValue) PURE;
+ STDMETHOD(get_SelectionEnd)(double __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_SelectionEnd)(double pValue) PURE;
+ STDMETHOD(get_CurrentState)(StateConstants __RPC_FAR *pState) PURE;
+ STDMETHOD(get_Rate)(double __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_Rate)(double pValue) PURE;
+ STDMETHOD(get_Volume)(long __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_Volume)(long pValue) PURE;
+ STDMETHOD(get_Balance)(long __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_Balance)(long pValue) PURE;
+ STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnable) PURE;
+ STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnable) PURE;
+ STDMETHOD(get_ShowDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowDisplay)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_ShowControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowControls)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_ShowPositionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowPositionControls)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_ShowSelectionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowSelectionControls)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_ShowTracker)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowTracker)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_EnablePositionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
+ STDMETHOD(put_EnablePositionControls)(VARIANT_BOOL Enable) PURE;
+ STDMETHOD(get_EnableSelectionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
+ STDMETHOD(put_EnableSelectionControls)(VARIANT_BOOL Enable) PURE;
+ STDMETHOD(get_EnableTracker)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
+ STDMETHOD(put_EnableTracker)(VARIANT_BOOL Enable) PURE;
+ STDMETHOD(get_AllowHideDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_AllowHideDisplay)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_AllowHideControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_AllowHideControls)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_DisplayMode)(DisplayModeConstants __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_DisplayMode)(DisplayModeConstants pValue) PURE;
+ STDMETHOD(get_AllowChangeDisplayMode)(VARIANT_BOOL __RPC_FAR *fAllow) PURE;
+ STDMETHOD(put_AllowChangeDisplayMode)(VARIANT_BOOL fAllow) PURE;
+ STDMETHOD(get_FilterGraph)(IUnknown __RPC_FAR *__RPC_FAR *ppFilterGraph) PURE;
+ STDMETHOD(put_FilterGraph)(IUnknown __RPC_FAR *ppFilterGraph) PURE;
+ STDMETHOD(get_FilterGraphDispatch)(IDispatch __RPC_FAR *__RPC_FAR *pDispatch) PURE;
+ STDMETHOD(get_DisplayForeColor)(unsigned long __RPC_FAR *ForeColor) PURE;
+ STDMETHOD(put_DisplayForeColor)(unsigned long ForeColor) PURE;
+ STDMETHOD(get_DisplayBackColor)(unsigned long __RPC_FAR *BackColor) PURE;
+ STDMETHOD(put_DisplayBackColor)(unsigned long BackColor) PURE;
+ STDMETHOD(get_MovieWindowSize)(WindowSizeConstants __RPC_FAR *WindowSize) PURE;
+ STDMETHOD(put_MovieWindowSize)(WindowSizeConstants WindowSize) PURE;
+ STDMETHOD(get_FullScreenMode)(VARIANT_BOOL __RPC_FAR *pEnable) PURE;
+ STDMETHOD(put_FullScreenMode)(VARIANT_BOOL pEnable) PURE;
+ STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pEnable) PURE;
+ STDMETHOD(put_AutoStart)(VARIANT_BOOL pEnable) PURE;
+ STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pEnable) PURE;
+ STDMETHOD(put_AutoRewind)(VARIANT_BOOL pEnable) PURE;
+ STDMETHOD(get_hWnd)(long __RPC_FAR *hWnd) PURE;
+ STDMETHOD(get_Appearance)(AppearanceConstants __RPC_FAR *pAppearance) PURE;
+ STDMETHOD(put_Appearance)(AppearanceConstants pAppearance) PURE;
+ STDMETHOD(get_BorderStyle)(BorderStyleConstants __RPC_FAR *pBorderStyle) PURE;
+ STDMETHOD(put_BorderStyle)(BorderStyleConstants pBorderStyle) PURE;
+ STDMETHOD(get_Enabled)(VARIANT_BOOL __RPC_FAR *pEnabled) PURE;
+ STDMETHOD(put_Enabled)(VARIANT_BOOL pEnabled) PURE;
+ STDMETHOD(get_Info)(long __RPC_FAR *ppInfo) PURE;
+};
+
+
+
+struct IActiveMovie2 : public IActiveMovie
+{
+ STDMETHOD(IsSoundCardEnabled)(VARIANT_BOOL __RPC_FAR *pbSoundCard) PURE;
+ STDMETHOD(get_ReadyState)(ReadyStateConstants __RPC_FAR *pValue) PURE;
+};
+
+struct IActiveMovie3 : public IActiveMovie2
+{
+ STDMETHOD(get_MediaPlayer)(IDispatch __RPC_FAR *__RPC_FAR *ppDispatch) PURE;
+};
+
+
+//---------------------------------------------------------------------------
+// MEDIAPLAYER COM INTERFACES (dumped from msdxm.idl from MSVC COM Browser)
+//---------------------------------------------------------------------------
+
+enum MPPlayStateConstants
+{
+ mpStopped = 0,
+ mpPaused = 1,
+ mpPlaying = 2,
+ mpWaiting = 3,
+ mpScanForward = 4,
+ mpScanReverse = 5,
+ mpClosed = 6
+};
+
+enum MPDisplaySizeConstants
+{
+ mpDefaultSize = 0,
+ mpHalfSize = 1,
+ mpDoubleSize = 2,
+ mpFullScreen = 3,
+ mpFitToSize = 4,
+ mpOneSixteenthScreen = 5,
+ mpOneFourthScreen = 6,
+ mpOneHalfScreen = 7
+};
+
+enum MPReadyStateConstants
+{
+ mpReadyStateUninitialized = 0,
+ mpReadyStateLoading = 1,
+ mpReadyStateInteractive = 3,
+ mpReadyStateComplete = 4
+};
+
+typedef unsigned long VB_OLE_COLOR;
+
+enum MPDisplayModeConstants
+{
+ mpTime = 0,
+ mpFrames = 1
+};
+
+enum MPMoreInfoType
+{
+ mpShowURL = 0,
+ mpClipURL = 1,
+ mpBannerURL = 2
+};
+
+enum MPMediaInfoType
+{
+ mpShowFilename = 0,
+ mpShowTitle = 1,
+ mpShowAuthor = 2,
+ mpShowCopyright = 3,
+ mpShowRating = 4,
+ mpShowDescription = 5,
+ mpShowLogoIcon = 6,
+ mpClipFilename = 7,
+ mpClipTitle = 8,
+ mpClipAuthor = 9,
+ mpClipCopyright = 10,
+ mpClipRating = 11,
+ mpClipDescription = 12,
+ mpClipLogoIcon = 13,
+ mpBannerImage = 14,
+ mpBannerMoreInfo = 15,
+ mpWatermark = 16
+};
+
+enum DVDMenuIDConstants
+{
+ dvdMenu_Title = 2,
+ dvdMenu_Root = 3,
+ dvdMenu_Subpicture = 4,
+ dvdMenu_Audio = 5,
+ dvdMenu_Angle = 6,
+ dvdMenu_Chapter = 7
+};
+
+enum MPShowDialogConstants
+{
+ mpShowDialogHelp = 0,
+ mpShowDialogStatistics = 1,
+ mpShowDialogOptions = 2,
+ mpShowDialogContextMenu = 3
+};
+
+
+struct IMediaPlayer : public IDispatch
+{
+ STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pCurrentPosition) PURE;
+ STDMETHOD(put_CurrentPosition)(double pCurrentPosition) PURE;
+ STDMETHOD(get_Duration)(double __RPC_FAR *pDuration) PURE;
+ STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE;
+ STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE;
+ STDMETHOD(get_MarkerCount)(long __RPC_FAR *pMarkerCount) PURE;
+ STDMETHOD(get_CanScan)(VARIANT_BOOL __RPC_FAR *pCanScan) PURE;
+ STDMETHOD(get_CanSeek)(VARIANT_BOOL __RPC_FAR *pCanSeek) PURE;
+ STDMETHOD(get_CanSeekToMarkers)(VARIANT_BOOL __RPC_FAR *pCanSeekToMarkers) PURE;
+ STDMETHOD(get_CurrentMarker)(long __RPC_FAR *pCurrentMarker) PURE;
+ STDMETHOD(put_CurrentMarker)(long pCurrentMarker) PURE;
+ STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE;
+ STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE;
+ STDMETHOD(get_SourceLink)(BSTR __RPC_FAR *pbstrSourceLink) PURE;
+ STDMETHOD(get_CreationDate)(DATE __RPC_FAR *pCreationDate) PURE;
+ STDMETHOD(get_ErrorCorrection)(BSTR __RPC_FAR *pbstrErrorCorrection) PURE;
+ STDMETHOD(get_Bandwidth)(long __RPC_FAR *pBandwidth) PURE;
+ STDMETHOD(get_SourceProtocol)(long __RPC_FAR *pSourceProtocol) PURE;
+ STDMETHOD(get_ReceivedPackets)(long __RPC_FAR *pReceivedPackets) PURE;
+ STDMETHOD(get_RecoveredPackets)(long __RPC_FAR *pRecoveredPackets) PURE;
+ STDMETHOD(get_LostPackets)(long __RPC_FAR *pLostPackets) PURE;
+ STDMETHOD(get_ReceptionQuality)(long __RPC_FAR *pReceptionQuality) PURE;
+ STDMETHOD(get_BufferingCount)(long __RPC_FAR *pBufferingCount) PURE;
+ STDMETHOD(get_IsBroadcast)(VARIANT_BOOL __RPC_FAR *pIsBroadcast) PURE;
+ STDMETHOD(get_BufferingProgress)(long __RPC_FAR *pBufferingProgress) PURE;
+ STDMETHOD(get_ChannelName)(BSTR __RPC_FAR *pbstrChannelName) PURE;
+ STDMETHOD(get_ChannelDescription)(BSTR __RPC_FAR *pbstrChannelDescription) PURE;
+ STDMETHOD(get_ChannelURL)(BSTR __RPC_FAR *pbstrChannelURL) PURE;
+ STDMETHOD(get_ContactAddress)(BSTR __RPC_FAR *pbstrContactAddress) PURE;
+ STDMETHOD(get_ContactPhone)(BSTR __RPC_FAR *pbstrContactPhone) PURE;
+ STDMETHOD(get_ContactEmail)(BSTR __RPC_FAR *pbstrContactEmail) PURE;
+ STDMETHOD(get_BufferingTime)(double __RPC_FAR *pBufferingTime) PURE;
+ STDMETHOD(put_BufferingTime)(double pBufferingTime) PURE;
+ STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pAutoStart) PURE;
+ STDMETHOD(put_AutoStart)(VARIANT_BOOL pAutoStart) PURE;
+ STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pAutoRewind) PURE;
+ STDMETHOD(put_AutoRewind)(VARIANT_BOOL pAutoRewind) PURE;
+ STDMETHOD(get_Rate)(double __RPC_FAR *pRate) PURE;
+ STDMETHOD(put_Rate)(double pRate) PURE;
+ STDMETHOD(get_SendKeyboardEvents)(VARIANT_BOOL __RPC_FAR *pSendKeyboardEvents) PURE;
+ STDMETHOD(put_SendKeyboardEvents)(VARIANT_BOOL pSendKeyboardEvents) PURE;
+ STDMETHOD(get_SendMouseClickEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseClickEvents) PURE;
+ STDMETHOD(put_SendMouseClickEvents)(VARIANT_BOOL pSendMouseClickEvents) PURE;
+ STDMETHOD(get_SendMouseMoveEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseMoveEvents) PURE;
+ STDMETHOD(put_SendMouseMoveEvents)(VARIANT_BOOL pSendMouseMoveEvents) PURE;
+ STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE;
+ STDMETHOD(put_PlayCount)(long pPlayCount) PURE;
+ STDMETHOD(get_ClickToPlay)(VARIANT_BOOL __RPC_FAR *pClickToPlay) PURE;
+ STDMETHOD(put_ClickToPlay)(VARIANT_BOOL pClickToPlay) PURE;
+ STDMETHOD(get_AllowScan)(VARIANT_BOOL __RPC_FAR *pAllowScan) PURE;
+ STDMETHOD(put_AllowScan)(VARIANT_BOOL pAllowScan) PURE;
+ STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnableContextMenu) PURE;
+ STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnableContextMenu) PURE;
+ STDMETHOD(get_CursorType)(long __RPC_FAR *pCursorType) PURE;
+ STDMETHOD(put_CursorType)(long pCursorType) PURE;
+ STDMETHOD(get_CodecCount)(long __RPC_FAR *pCodecCount) PURE;
+ STDMETHOD(get_AllowChangeDisplaySize)(VARIANT_BOOL __RPC_FAR *pAllowChangeDisplaySize) PURE;
+ STDMETHOD(put_AllowChangeDisplaySize)( VARIANT_BOOL pAllowChangeDisplaySize) PURE;
+ STDMETHOD(get_IsDurationValid)(VARIANT_BOOL __RPC_FAR *pIsDurationValid) PURE;
+ STDMETHOD(get_OpenState)(long __RPC_FAR *pOpenState) PURE;
+ STDMETHOD(get_SendOpenStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendOpenStateChangeEvents) PURE;
+ STDMETHOD(put_SendOpenStateChangeEvents)(VARIANT_BOOL pSendOpenStateChangeEvents) PURE;
+ STDMETHOD(get_SendWarningEvents)( VARIANT_BOOL __RPC_FAR *pSendWarningEvents) PURE;
+ STDMETHOD(put_SendWarningEvents)(VARIANT_BOOL pSendWarningEvents) PURE;
+ STDMETHOD(get_SendErrorEvents)(VARIANT_BOOL __RPC_FAR *pSendErrorEvents) PURE;
+ STDMETHOD(put_SendErrorEvents)(VARIANT_BOOL pSendErrorEvents) PURE;
+ STDMETHOD(get_PlayState)(MPPlayStateConstants __RPC_FAR *pPlayState) PURE;
+ STDMETHOD(get_SendPlayStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendPlayStateChangeEvents) PURE;
+ STDMETHOD(put_SendPlayStateChangeEvents)(VARIANT_BOOL pSendPlayStateChangeEvents) PURE;
+ STDMETHOD(get_DisplaySize)(MPDisplaySizeConstants __RPC_FAR *pDisplaySize) PURE;
+ STDMETHOD(put_DisplaySize)(MPDisplaySizeConstants pDisplaySize) PURE;
+ STDMETHOD(get_InvokeURLs)(VARIANT_BOOL __RPC_FAR *pInvokeURLs) PURE;
+ STDMETHOD(put_InvokeURLs)(VARIANT_BOOL pInvokeURLs) PURE;
+ STDMETHOD(get_BaseURL)(BSTR __RPC_FAR *pbstrBaseURL) PURE;
+ STDMETHOD(put_BaseURL)(BSTR pbstrBaseURL) PURE;
+ STDMETHOD(get_DefaultFrame)(BSTR __RPC_FAR *pbstrDefaultFrame) PURE;
+ STDMETHOD(put_DefaultFrame)(BSTR pbstrDefaultFrame) PURE;
+ STDMETHOD(get_HasError)(VARIANT_BOOL __RPC_FAR *pHasError) PURE;
+ STDMETHOD(get_ErrorDescription)(BSTR __RPC_FAR *pbstrErrorDescription) PURE;
+ STDMETHOD(get_ErrorCode)(long __RPC_FAR *pErrorCode) PURE;
+ STDMETHOD(get_AnimationAtStart)(VARIANT_BOOL __RPC_FAR *pAnimationAtStart) PURE;
+ STDMETHOD(put_AnimationAtStart)(VARIANT_BOOL pAnimationAtStart) PURE;
+ STDMETHOD(get_TransparentAtStart)( VARIANT_BOOL __RPC_FAR *pTransparentAtStart) PURE;
+ STDMETHOD(put_TransparentAtStart)(VARIANT_BOOL pTransparentAtStart) PURE;
+ STDMETHOD(get_Volume)(long __RPC_FAR *pVolume) PURE;
+ STDMETHOD(put_Volume)(long pVolume) PURE;
+ STDMETHOD(get_Balance)(long __RPC_FAR *pBalance) PURE;
+ STDMETHOD(put_Balance)(long pBalance) PURE;
+ STDMETHOD(get_ReadyState)(MPReadyStateConstants __RPC_FAR *pValue) PURE;
+ STDMETHOD(get_SelectionStart)(double __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_SelectionStart)(double pValue) PURE;
+ STDMETHOD(get_SelectionEnd)(double __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_SelectionEnd)(double pValue) PURE;
+ STDMETHOD(get_ShowDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowDisplay)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_ShowControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowControls)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_ShowPositionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowPositionControls)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_ShowTracker)(VARIANT_BOOL __RPC_FAR *Show) PURE;
+ STDMETHOD(put_ShowTracker)(VARIANT_BOOL Show) PURE;
+ STDMETHOD(get_EnablePositionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
+ STDMETHOD(put_EnablePositionControls)(VARIANT_BOOL Enable) PURE;
+ STDMETHOD(get_EnableTracker)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
+ STDMETHOD(put_EnableTracker)(VARIANT_BOOL Enable) PURE;
+ STDMETHOD(get_Enabled)(VARIANT_BOOL __RPC_FAR *pEnabled) PURE;
+ STDMETHOD(put_Enabled)(VARIANT_BOOL pEnabled) PURE;
+ STDMETHOD(get_DisplayForeColor)(VB_OLE_COLOR __RPC_FAR *ForeColor) PURE;
+ STDMETHOD(put_DisplayForeColor)(VB_OLE_COLOR ForeColor) PURE;
+ STDMETHOD(get_DisplayBackColor)(VB_OLE_COLOR __RPC_FAR *BackColor) PURE;
+ STDMETHOD(put_DisplayBackColor)(VB_OLE_COLOR BackColor) PURE;
+ STDMETHOD(get_DisplayMode)(MPDisplayModeConstants __RPC_FAR *pValue) PURE;
+ STDMETHOD(put_DisplayMode)(MPDisplayModeConstants pValue) PURE;
+ STDMETHOD(get_VideoBorder3D)(VARIANT_BOOL __RPC_FAR *pVideoBorderWidth) PURE;
+ STDMETHOD(put_VideoBorder3D)(VARIANT_BOOL pVideoBorderWidth) PURE;
+ STDMETHOD(get_VideoBorderWidth)(long __RPC_FAR *pVideoBorderWidth) PURE;
+ STDMETHOD(put_VideoBorderWidth)(long pVideoBorderWidth) PURE;
+ STDMETHOD(get_VideoBorderColor)(VB_OLE_COLOR __RPC_FAR *pVideoBorderWidth) PURE;
+ STDMETHOD(put_VideoBorderColor)(VB_OLE_COLOR pVideoBorderWidth) PURE;
+ STDMETHOD(get_ShowGotoBar)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
+ STDMETHOD(put_ShowGotoBar)(VARIANT_BOOL pbool) PURE;
+ STDMETHOD(get_ShowStatusBar)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
+ STDMETHOD(put_ShowStatusBar)(VARIANT_BOOL pbool) PURE;
+ STDMETHOD(get_ShowCaptioning)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
+ STDMETHOD(put_ShowCaptioning)(VARIANT_BOOL pbool) PURE;
+ STDMETHOD(get_ShowAudioControls)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
+ STDMETHOD(put_ShowAudioControls)(VARIANT_BOOL pbool) PURE;
+ STDMETHOD(get_CaptioningID)( BSTR __RPC_FAR *pstrText) PURE;
+ STDMETHOD(put_CaptioningID)(BSTR pstrText) PURE;
+ STDMETHOD(get_Mute)(VARIANT_BOOL __RPC_FAR *vbool) PURE;
+ STDMETHOD(put_Mute)(VARIANT_BOOL vbool) PURE;
+ STDMETHOD(get_CanPreview)(VARIANT_BOOL __RPC_FAR *pCanPreview) PURE;
+ STDMETHOD(get_PreviewMode)(VARIANT_BOOL __RPC_FAR *pPreviewMode) PURE;
+ STDMETHOD(put_PreviewMode)(VARIANT_BOOL pPreviewMode) PURE;
+ STDMETHOD(get_HasMultipleItems)(VARIANT_BOOL __RPC_FAR *pHasMuliItems) PURE;
+ STDMETHOD(get_Language)(long __RPC_FAR *pLanguage) PURE;
+ STDMETHOD(put_Language)(long pLanguage) PURE;
+ STDMETHOD(get_AudioStream)(long __RPC_FAR *pStream) PURE;
+ STDMETHOD(put_AudioStream)(long pStream) PURE;
+ STDMETHOD(get_SAMIStyle)(BSTR __RPC_FAR *pbstrStyle) PURE;
+ STDMETHOD(put_SAMIStyle)(BSTR pbstrStyle) PURE;
+ STDMETHOD(get_SAMILang)(BSTR __RPC_FAR *pbstrLang) PURE;
+ STDMETHOD(put_SAMILang)(BSTR pbstrLang) PURE;
+ STDMETHOD(get_SAMIFileName)(BSTR __RPC_FAR *pbstrFileName) PURE;
+ STDMETHOD(put_SAMIFileName)(BSTR pbstrFileName) PURE;
+ STDMETHOD(get_StreamCount)( long __RPC_FAR *pStreamCount) PURE;
+ STDMETHOD(get_ClientId)(BSTR __RPC_FAR *pbstrClientId) PURE;
+ STDMETHOD(get_ConnectionSpeed)(long __RPC_FAR *plConnectionSpeed) PURE;
+ STDMETHOD(get_AutoSize)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
+ STDMETHOD(put_AutoSize)(VARIANT_BOOL pbool) PURE;
+ STDMETHOD(get_EnableFullScreenControls)(VARIANT_BOOL __RPC_FAR *pbVal) PURE;
+ STDMETHOD(put_EnableFullScreenControls)(VARIANT_BOOL pbVal) PURE;
+ STDMETHOD(get_ActiveMovie)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE;
+ STDMETHOD(get_NSPlay)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE;
+ STDMETHOD(get_WindowlessVideo)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
+ STDMETHOD(put_WindowlessVideo)(VARIANT_BOOL pbool) PURE;
+ STDMETHOD(Play)(void) PURE;
+ STDMETHOD(Stop)(void) PURE;
+ STDMETHOD(Pause)(void) PURE;
+ STDMETHOD(GetMarkerTime)(long MarkerNum,
+ double __RPC_FAR *pMarkerTime) PURE;
+ STDMETHOD(GetMarkerName)(long MarkerNum,
+ BSTR __RPC_FAR *pbstrMarkerName) PURE;
+ STDMETHOD(AboutBox)(void) PURE;
+ STDMETHOD(GetCodecInstalled)(long CodecNum,
+ VARIANT_BOOL __RPC_FAR *pCodecInstalled) PURE;
+ STDMETHOD(GetCodecDescription)(long CodecNum,
+ BSTR __RPC_FAR *pbstrCodecDescription) PURE;
+ STDMETHOD(GetCodecURL)(long CodecNum,
+ BSTR __RPC_FAR *pbstrCodecURL) PURE;
+ STDMETHOD(GetMoreInfoURL)(MPMoreInfoType MoreInfoType,
+ BSTR __RPC_FAR *pbstrMoreInfoURL) PURE;
+ STDMETHOD(GetMediaInfoString)(MPMediaInfoType MediaInfoType,
+ BSTR __RPC_FAR *pbstrMediaInfo) PURE;
+ STDMETHOD(Cancel)(void) PURE;
+ STDMETHOD(Open)(BSTR bstrFileName) PURE;
+ STDMETHOD(IsSoundCardEnabled)(VARIANT_BOOL __RPC_FAR *pbSoundCard) PURE;
+ STDMETHOD(Next)(void) PURE;
+ STDMETHOD(Previous)(void) PURE;
+ STDMETHOD(StreamSelect)(long StreamNum) PURE;
+ STDMETHOD(FastForward)(void) PURE;
+ STDMETHOD(FastReverse)(void) PURE;
+ STDMETHOD(GetStreamName)(long StreamNum,
+ BSTR __RPC_FAR *pbstrStreamName) PURE;
+ STDMETHOD(GetStreamGroup)(long StreamNum,
+ long __RPC_FAR *pStreamGroup) PURE;
+ STDMETHOD(GetStreamSelected)(long StreamNum, VARIANT_BOOL __RPC_FAR *pStreamSelected) PURE;
+};
+
+struct IMediaPlayer2 : public IMediaPlayer
+{
+ STDMETHOD(get_DVD)(struct IMediaPlayerDvd __RPC_FAR *__RPC_FAR *ppdispatch) PURE;
+ STDMETHOD(GetMediaParameter)(long EntryNum, BSTR bstrParameterName, BSTR __RPC_FAR *pbstrParameterValue) PURE;
+ STDMETHOD(GetMediaParameterName(long EntryNum, long Index, BSTR __RPC_FAR *pbstrParameterName) PURE;
+ STDMETHOD(get_EntryCount)(long __RPC_FAR *pNumberEntries) PURE;
+ STDMETHOD(GetCurrentEntry)(long __RPC_FAR *pEntryNumber) PURE;
+ STDMETHOD(SetCurrentEntry)(long EntryNumber) PURE;
+ STDMETHOD(ShowDialog)(MPShowDialogConstants mpDialogIndex) PURE;
+};
+
+//---------------------------------------------------------------------------
+// NETSHOW COM INTERFACES (dumped from nscompat.idl from MSVC COM Browser)
+//---------------------------------------------------------------------------
+
+struct INSOPlay : public IDispatch
+{
+ STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE;
+ STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE;
+ STDMETHOD(get_Duration)(double __RPC_FAR *pDuration) PURE;
+ STDMETHOD(get_Author)(BSTR __RPC_FAR *pbstrAuthor) PURE;
+ STDMETHOD(get_Copyright)(BSTR __RPC_FAR *pbstrCopyright) PURE;
+ STDMETHOD(get_Description)(BSTR __RPC_FAR *pbstrDescription) PURE;
+ STDMETHOD(get_Rating)(BSTR __RPC_FAR *pbstrRating) PURE;
+ STDMETHOD(get_Title)(BSTR __RPC_FAR *pbstrTitle) PURE;
+ STDMETHOD(get_SourceLink)(BSTR __RPC_FAR *pbstrSourceLink) PURE;
+ STDMETHOD(get_MarkerCount)(long __RPC_FAR *pMarkerCount) PURE;
+ STDMETHOD(get_CanScan)(VARIANT_BOOL __RPC_FAR *pCanScan) PURE;
+ STDMETHOD(get_CanSeek)(VARIANT_BOOL __RPC_FAR *pCanSeek) PURE;
+ STDMETHOD(get_CanSeekToMarkers)(VARIANT_BOOL __RPC_FAR *pCanSeekToMarkers) PURE;
+ STDMETHOD(get_CreationDate)(DATE __RPC_FAR *pCreationDate) PURE;
+ STDMETHOD(get_Bandwidth)(long __RPC_FAR *pBandwidth) PURE;
+ STDMETHOD(get_ErrorCorrection)(BSTR __RPC_FAR *pbstrErrorCorrection) PURE;
+ STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pAutoStart) PURE;
+ STDMETHOD(put_AutoStart)(VARIANT_BOOL pAutoStart) PURE;
+ STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pAutoRewind) PURE;
+ STDMETHOD(put_AutoRewind)(VARIANT_BOOL pAutoRewind) PURE;
+ STDMETHOD(get_AllowChangeControlType)(VARIANT_BOOL __RPC_FAR *pAllowChangeControlType) PURE;
+ STDMETHOD(put_AllowChangeControlType)(VARIANT_BOOL pAllowChangeControlType) PURE;
+ STDMETHOD(get_InvokeURLs)(VARIANT_BOOL __RPC_FAR *pInvokeURLs) PURE;
+ STDMETHOD(put_InvokeURLs)(VARIANT_BOOL pInvokeURLs) PURE;
+ STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnableContextMenu) PURE;
+ STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnableContextMenu) PURE;
+ STDMETHOD(get_TransparentAtStart)(VARIANT_BOOL __RPC_FAR *pTransparentAtStart) PURE;
+ STDMETHOD(put_TransparentAtStart)(VARIANT_BOOL pTransparentAtStart) PURE;
+ STDMETHOD(get_TransparentOnStop)(VARIANT_BOOL __RPC_FAR *pTransparentOnStop) PURE;
+ STDMETHOD(put_TransparentOnStop)(VARIANT_BOOL pTransparentOnStop) PURE;
+ STDMETHOD(get_ClickToPlay)(VARIANT_BOOL __RPC_FAR *pClickToPlay) PURE;
+ STDMETHOD(put_ClickToPlay)(VARIANT_BOOL pClickToPlay) PURE;
+ STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE;
+ STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE;
+ STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pCurrentPosition) PURE;
+ STDMETHOD(put_CurrentPosition)(double pCurrentPosition) PURE;
+ STDMETHOD(get_Rate)(double __RPC_FAR *pRate) PURE;
+ STDMETHOD(put_Rate)(double pRate) PURE;
+ STDMETHOD(get_CurrentMarker)(long __RPC_FAR *pCurrentMarker) PURE;
+ STDMETHOD(put_CurrentMarker)(long pCurrentMarker) PURE;
+ STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE;
+ STDMETHOD(put_PlayCount)(long pPlayCount) PURE;
+ STDMETHOD(get_CurrentState)(long __RPC_FAR *pCurrentState) PURE;
+ STDMETHOD(get_DisplaySize)(long __RPC_FAR *pDisplaySize) PURE;
+ STDMETHOD(put_DisplaySize)(long pDisplaySize) PURE;
+ STDMETHOD(get_MainWindow)(long __RPC_FAR *pMainWindow) PURE;
+ STDMETHOD(get_ControlType)(long __RPC_FAR *pControlType) PURE;
+ STDMETHOD(put_ControlType)(long pControlType) PURE;
+ STDMETHOD(get_AllowScan)(VARIANT_BOOL __RPC_FAR *pAllowScan) PURE;
+ STDMETHOD(put_AllowScan)(VARIANT_BOOL pAllowScan) PURE;
+ STDMETHOD(get_SendKeyboardEvents)(VARIANT_BOOL __RPC_FAR *pSendKeyboardEvents) PURE;
+ STDMETHOD(put_SendKeyboardEvents)(VARIANT_BOOL pSendKeyboardEvents) PURE;
+ STDMETHOD(get_SendMouseClickEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseClickEvents) PURE;
+ STDMETHOD(put_SendMouseClickEvents)(VARIANT_BOOL pSendMouseClickEvents) PURE;
+ STDMETHOD(get_SendMouseMoveEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseMoveEvents) PURE;
+ STDMETHOD(put_SendMouseMoveEvents)(VARIANT_BOOL pSendMouseMoveEvents) PURE;
+ STDMETHOD(get_SendStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendStateChangeEvents) PURE;
+ STDMETHOD(put_SendStateChangeEvents)(VARIANT_BOOL pSendStateChangeEvents) PURE;
+ STDMETHOD(get_ReceivedPackets)(long __RPC_FAR *pReceivedPackets) PURE;
+ STDMETHOD(get_RecoveredPackets)(long __RPC_FAR *pRecoveredPackets) PURE;
+ STDMETHOD(get_LostPackets)(long __RPC_FAR *pLostPackets) PURE;
+ STDMETHOD(get_ReceptionQuality)(long __RPC_FAR *pReceptionQuality) PURE;
+ STDMETHOD(get_BufferingCount)(long __RPC_FAR *pBufferingCount) PURE;
+ STDMETHOD(get_CursorType)(long __RPC_FAR *pCursorType) PURE;
+ STDMETHOD(put_CursorType)(long pCursorType) PURE;
+ STDMETHOD(get_AnimationAtStart)(VARIANT_BOOL __RPC_FAR *pAnimationAtStart) PURE;
+ STDMETHOD(put_AnimationAtStart)(VARIANT_BOOL pAnimationAtStart) PURE;
+ STDMETHOD(get_AnimationOnStop)(VARIANT_BOOL __RPC_FAR *pAnimationOnStop) PURE;
+ STDMETHOD(put_AnimationOnStop)(VARIANT_BOOL pAnimationOnStop) PURE;
+ STDMETHOD(Play)(void) PURE;
+ STDMETHOD(Pause)(void) PURE;
+ STDMETHOD(Stop)(void) PURE;
+ STDMETHOD(GetMarkerTime)(long MarkerNum, double __RPC_FAR *pMarkerTime) PURE;
+ STDMETHOD(GetMarkerName)(long MarkerNum, BSTR __RPC_FAR *pbstrMarkerName) PURE;
+};
+
+struct INSPlay : public INSOPlay
+{
+ STDMETHOD(get_ChannelName)(BSTR __RPC_FAR *pbstrChannelName) PURE;
+ STDMETHOD(get_ChannelDescription)(BSTR __RPC_FAR *pbstrChannelDescription) PURE;
+ STDMETHOD(get_ChannelURL)(BSTR __RPC_FAR *pbstrChannelURL) PURE;
+ STDMETHOD(get_ContactAddress)(BSTR __RPC_FAR *pbstrContactAddress) PURE;
+ STDMETHOD(get_ContactPhone)(BSTR __RPC_FAR *pbstrContactPhone) PURE;
+ STDMETHOD(get_ContactEmail)(BSTR __RPC_FAR *pbstrContactEmail) PURE;
+ STDMETHOD(get_AllowChangeDisplaySize)(VARIANT_BOOL __RPC_FAR *pAllowChangeDisplaySize) PURE;
+ STDMETHOD(put_AllowChangeDisplaySize)(VARIANT_BOOL pAllowChangeDisplaySize) PURE;
+ STDMETHOD(get_CodecCount)(long __RPC_FAR *pCodecCount) PURE;
+ STDMETHOD(get_IsBroadcast)(VARIANT_BOOL __RPC_FAR *pIsBroadcast) PURE;
+ STDMETHOD(get_IsDurationValid)(VARIANT_BOOL __RPC_FAR *pIsDurationValid) PURE;
+ STDMETHOD(get_SourceProtocol)(long __RPC_FAR *pSourceProtocol) PURE;
+ STDMETHOD(get_OpenState)(long __RPC_FAR *pOpenState) PURE;
+ STDMETHOD(get_SendOpenStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendOpenStateChangeEvents) PURE;
+ STDMETHOD(put_SendOpenStateChangeEvents)(VARIANT_BOOL pSendOpenStateChangeEvents) PURE;
+ STDMETHOD(get_SendWarningEvents)(VARIANT_BOOL __RPC_FAR *pSendWarningEvents) PURE;
+ STDMETHOD(put_SendWarningEvents)(VARIANT_BOOL pSendWarningEvents) PURE;
+ STDMETHOD(get_SendErrorEvents)(VARIANT_BOOL __RPC_FAR *pSendErrorEvents) PURE;
+ STDMETHOD(put_SendErrorEvents)(VARIANT_BOOL pSendErrorEvents) PURE;
+ STDMETHOD(get_HasError)(VARIANT_BOOL __RPC_FAR *pHasError) PURE;
+ STDMETHOD(get_ErrorDescription)(BSTR __RPC_FAR *pbstrErrorDescription) PURE;
+ STDMETHOD(get_ErrorCode)(long __RPC_FAR *pErrorCode) PURE;
+ STDMETHOD(get_PlayState)(long __RPC_FAR *pPlayState) PURE;
+ STDMETHOD(get_SendPlayStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendPlayStateChangeEvents) PURE;
+ STDMETHOD(put_SendPlayStateChangeEvents)(VARIANT_BOOL pSendPlayStateChangeEvents) PURE;
+ STDMETHOD(get_BufferingTime)(double __RPC_FAR *pBufferingTime) PURE;
+ STDMETHOD(put_BufferingTime)(double pBufferingTime) PURE;
+ STDMETHOD(get_UseFixedUDPPort)(VARIANT_BOOL __RPC_FAR *pUseFixedUDPPort) PURE;
+ STDMETHOD(put_UseFixedUDPPort)(VARIANT_BOOL pUseFixedUDPPort) PURE;
+ STDMETHOD(get_FixedUDPPort)(long __RPC_FAR *pFixedUDPPort) PURE;
+ STDMETHOD(put_FixedUDPPort)(long pFixedUDPPort) PURE;
+ STDMETHOD(get_UseHTTPProxy)(VARIANT_BOOL __RPC_FAR *pUseHTTPProxy) PURE;
+ STDMETHOD(put_UseHTTPProxy)(VARIANT_BOOL pUseHTTPProxy) PURE;
+ STDMETHOD(get_EnableAutoProxy)(VARIANT_BOOL __RPC_FAR *pEnableAutoProxy) PURE;
+ STDMETHOD(put_EnableAutoProxy)(VARIANT_BOOL pEnableAutoProxy) PURE;
+ STDMETHOD(get_HTTPProxyHost)(BSTR __RPC_FAR *pbstrHTTPProxyHost) PURE;
+ STDMETHOD(put_HTTPProxyHost)(BSTR pbstrHTTPProxyHost) PURE;
+ STDMETHOD(get_HTTPProxyPort)(long __RPC_FAR *pHTTPProxyPort) PURE;
+ STDMETHOD(put_HTTPProxyPort)(long pHTTPProxyPort) PURE;
+ STDMETHOD(get_EnableMulticast)(VARIANT_BOOL __RPC_FAR *pEnableMulticast) PURE;
+ STDMETHOD(put_EnableMulticast)(VARIANT_BOOL pEnableMulticast) PURE;
+ STDMETHOD(get_EnableUDP)(VARIANT_BOOL __RPC_FAR *pEnableUDP) PURE;
+ STDMETHOD(put_EnableUDP)(VARIANT_BOOL pEnableUDP) PURE;
+ STDMETHOD(get_EnableTCP)(VARIANT_BOOL __RPC_FAR *pEnableTCP) PURE;
+ STDMETHOD(put_EnableTCP)(VARIANT_BOOL pEnableTCP) PURE;
+ STDMETHOD(get_EnableHTTP)(VARIANT_BOOL __RPC_FAR *pEnableHTTP) PURE;
+ STDMETHOD(put_EnableHTTP)(VARIANT_BOOL pEnableHTTP) PURE;
+ STDMETHOD(get_BufferingProgress)(long __RPC_FAR *pBufferingProgress) PURE;
+ STDMETHOD(get_BaseURL)(BSTR __RPC_FAR *pbstrBaseURL) PURE;
+ STDMETHOD(put_BaseURL)(BSTR pbstrBaseURL) PURE;
+ STDMETHOD(get_DefaultFrame)(BSTR __RPC_FAR *pbstrDefaultFrame) PURE;
+ STDMETHOD(put_DefaultFrame)(BSTR pbstrDefaultFrame) PURE;
+ STDMETHOD(AboutBox))(void) PURE;
+ STDMETHOD(Cancel)(void) PURE;
+ STDMETHOD(GetCodecInstalled)(long CodecNum, VARIANT_BOOL __RPC_FAR *pCodecInstalled) PURE;
+ STDMETHOD(GetCodecDescription)(long CodecNum, BSTR __RPC_FAR *pbstrCodecDescription) PURE;
+ STDMETHOD(GetCodecURL)(long CodecNum, BSTR __RPC_FAR *pbstrCodecURL) PURE;
+ STDMETHOD(Open)(BSTR bstrFileName) PURE;
+};
+
+
+struct INSPlay1 : public INSPlay
+{
+ STDMETHOD(get_MediaPlayer)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE;
+};
+
+//---------------------------------------------------------------------------
+// MISC COM INTERFACES
+//---------------------------------------------------------------------------
+typedef enum _FilterState
+{
+ State_Stopped,
+ State_Paused,
+ State_Running
+} FILTER_STATE;
+typedef enum _PinDirection {
+ PINDIR_INPUT,
+ PINDIR_OUTPUT
+} PIN_DIRECTION;
+
+typedef struct _FilterInfo {
+ WCHAR achName[128];
+ struct IFilterGraph *pGraph;
+} FILTER_INFO;
+
+typedef struct _PinInfo {
+ struct IBaseFilter *pFilter;
+ PIN_DIRECTION dir;
+ WCHAR achName[128];
+} PIN_INFO;
+
+struct IBaseFilter;
+struct IPin;
+struct IEnumFilters;
+typedef struct _MediaType {
+ GUID majortype;
+ GUID subtype;
+ BOOL bFixedSizeSamples;
+ BOOL bTemporalCompression;
+ ULONG lSampleSize;
+ GUID formattype;
+ IUnknown *pUnk;
+ ULONG cbFormat;
+ BYTE *pbFormat;
+} AM_MEDIA_TYPE;
+
+struct IFilterGraph : public IUnknown
+{
+ STDMETHOD(AddFilter)(IBaseFilter *, LPCWSTR) PURE;
+ STDMETHOD(RemoveFilter)(IBaseFilter *) PURE;
+ STDMETHOD(EnumFilters)(IEnumFilters **) PURE;
+ STDMETHOD(FindFilterByName)(LPCWSTR, IBaseFilter **) PURE;
+ STDMETHOD(ConnectDirect)(IPin *, IPin *, const AM_MEDIA_TYPE *) PURE;
+ STDMETHOD(Reconnect)(IPin *) PURE;
+ STDMETHOD(Disconnect)(IPin *) PURE;
+ STDMETHOD(SetDefaultSyncSource)() PURE;
+};
+
+struct IGraphBuilder : public IFilterGraph
+{
+ STDMETHOD(Connect)(IPin *, IPin *) PURE;
+ STDMETHOD(Render)(IPin *) PURE;
+ STDMETHOD(RenderFile)(LPCWSTR, LPCWSTR) PURE;
+ STDMETHOD(AddSourceFilter)(LPCWSTR, LPCWSTR, IBaseFilter **) PURE;
+ STDMETHOD(SetLogFile)(DWORD_PTR) PURE;
+ STDMETHOD(Abort)() PURE;
+ STDMETHOD(ShouldOperationContinue)() PURE;
+};
+
+struct IReferenceClock;
+struct IEnumPins;
+#define REFERENCE_TIME LONGLONG
+struct IMediaFilter : public IPersist
+{
+ STDMETHOD(Stop)( void) PURE;
+ STDMETHOD(Pause)( void) PURE;
+ STDMETHOD(Run)(REFERENCE_TIME tStart) PURE;
+ STDMETHOD(GetState)(DWORD dwMilliSecsTimeout,
+ FILTER_STATE *State) PURE;
+ STDMETHOD(SetSyncSource)(IReferenceClock *pClock) PURE;
+ STDMETHOD(GetSyncSource)(IReferenceClock **pClock) PURE;
+};
+
+struct IBaseFilter : public IMediaFilter
+{
+ STDMETHOD(EnumPins)(IEnumPins **ppEnum) PURE;
+ STDMETHOD(FindPin)(LPCWSTR Id, IPin **ppPin) PURE;
+ STDMETHOD(QueryFilterInfo)(FILTER_INFO *pInfo) PURE;
+ STDMETHOD(JoinFilterGraph)(IFilterGraph *pGraph, LPCWSTR pName) PURE;
+ STDMETHOD(QueryVendorInfo)(LPWSTR *pVendorInfo) PURE;
+};
+
+//---------------------------------------------------------------------------
+//
+// wxActiveX (Ryan Norton's version :))
+// wxActiveX is (C) 2003 Lindsay Mathieson
+//
+//---------------------------------------------------------------------------
+#define WX_DECLARE_AUTOOLE(wxAutoOleInterface, I) \
+class wxAutoOleInterface \
+{ \
+ protected: \
+ I *m_interface; \
+\
+ public: \
+ explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {} \
+ wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) \
+ { QueryInterface(riid, pUnk); } \
+ wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) \
+ { QueryInterface(riid, pDispatch); } \
+ wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)\
+ { CreateInstance(clsid, riid); }\
+ wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL)\
+ { operator = (ti); }\
+\
+ wxAutoOleInterface& operator = (const wxAutoOleInterface& ti)\
+ {\
+ if (ti.m_interface)\
+ ti.m_interface->AddRef();\
+ Free();\
+ m_interface = ti.m_interface;\
+ return *this;\
+ }\
+\
+ wxAutoOleInterface& operator = (I *&ti)\
+ {\
+ Free();\
+ m_interface = ti;\
+ return *this;\
+ }\
+\
+ ~wxAutoOleInterface() { Free(); }\
+\
+ inline void Free()\
+ {\
+ if (m_interface)\
+ m_interface->Release();\
+ m_interface = NULL;\
+ }\
+\
+ HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)\
+ {\
+ Free();\
+ wxASSERT(pUnk != NULL);\
+ return pUnk->QueryInterface(riid, (void **) &m_interface);\
+ }\
+\
+ HRESULT CreateInstance(REFCLSID clsid, REFIID riid)\
+ {\
+ Free();\
+ return CoCreateInstance(clsid, NULL, CLSCTX_ALL, riid, (void **) &m_interface);\
+ }\
+\
+ inline operator I *() const {return m_interface;}\
+ inline I* operator ->() {return m_interface;}\
+ inline I** GetRef() {return &m_interface;}\
+ inline bool Ok() const {return m_interface != NULL;}\
+};
+
+WX_DECLARE_AUTOOLE(wxAutoIDispatch, IDispatch)
+WX_DECLARE_AUTOOLE(wxAutoIOleClientSite, IOleClientSite)
+WX_DECLARE_AUTOOLE(wxAutoIUnknown, IUnknown)
+WX_DECLARE_AUTOOLE(wxAutoIOleObject, IOleObject)
+WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceObject, IOleInPlaceObject)
+WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceActiveObject, IOleInPlaceActiveObject)
+WX_DECLARE_AUTOOLE(wxAutoIOleDocumentView, IOleDocumentView)
+WX_DECLARE_AUTOOLE(wxAutoIViewObject, IViewObject)
+WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceSite, IOleInPlaceSite)
+WX_DECLARE_AUTOOLE(wxAutoIOleDocument, IOleDocument)
+WX_DECLARE_AUTOOLE(wxAutoIPersistStreamInit, IPersistStreamInit)
+WX_DECLARE_AUTOOLE(wxAutoIAdviseSink, IAdviseSink)
+
+class wxActiveX : public wxWindow
+{
+public:
+ wxActiveX(wxWindow * parent, REFIID iid, IUnknown* pUnk);
+ virtual ~wxActiveX();
+
+ void OnSize(wxSizeEvent&);
+ void OnPaint(wxPaintEvent&);
+ void OnSetFocus(wxFocusEvent&);
+ void OnKillFocus(wxFocusEvent&);
+
+protected:
+ friend class FrameSite;
+
+ wxAutoIDispatch m_Dispatch;
+ wxAutoIOleClientSite m_clientSite;
+ wxAutoIUnknown m_ActiveX;
+ wxAutoIOleObject m_oleObject;
+ wxAutoIOleInPlaceObject m_oleInPlaceObject;
+ wxAutoIOleInPlaceActiveObject m_oleInPlaceActiveObject;
+ wxAutoIOleDocumentView m_docView;
+ wxAutoIViewObject m_viewObject;
+ HWND m_oleObjectHWND;
+ bool m_bAmbientUserMode;
+ DWORD m_docAdviseCookie;
+ wxWindow* m_realparent;
+
+ void CreateActiveX(REFIID, IUnknown*);
+};
+
+#define DECLARE_OLE_UNKNOWN(cls)\
+ private:\
+ class TAutoInitInt\
+ {\
+ public:\
+ LONG l;\
+ TAutoInitInt() : l(0) {}\
+ };\
+ TAutoInitInt refCount, lockCount;\
+ static void _GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc);\
+ public:\
+ LONG GetRefCount();\
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void ** ppvObject);\
+ ULONG STDMETHODCALLTYPE AddRef();\
+ ULONG STDMETHODCALLTYPE Release();\
+ ULONG STDMETHODCALLTYPE AddLock();\
+ ULONG STDMETHODCALLTYPE ReleaseLock()
+
+#define DEFINE_OLE_TABLE(cls)\
+ LONG cls::GetRefCount() {return refCount.l;}\
+ HRESULT STDMETHODCALLTYPE cls::QueryInterface(REFIID iid, void ** ppvObject)\
+ {\
+ if (! ppvObject)\
+ {\
+ return E_FAIL;\
+ };\
+ const char *desc = NULL;\
+ cls::_GetInterface(this, iid, ppvObject, desc);\
+ if (! *ppvObject)\
+ {\
+ return E_NOINTERFACE;\
+ };\
+ ((IUnknown * )(*ppvObject))->AddRef();\
+ return S_OK;\
+ };\
+ ULONG STDMETHODCALLTYPE cls::AddRef()\
+ {\
+ InterlockedIncrement(&refCount.l);\
+ return refCount.l;\
+ };\
+ ULONG STDMETHODCALLTYPE cls::Release()\
+ {\
+ if (refCount.l > 0)\
+ {\
+ InterlockedDecrement(&refCount.l);\
+ if (refCount.l == 0)\
+ {\
+ delete this;\
+ return 0;\
+ };\
+ return refCount.l;\
+ }\
+ else\
+ return 0;\
+ }\
+ ULONG STDMETHODCALLTYPE cls::AddLock()\
+ {\
+ InterlockedIncrement(&lockCount.l);\
+ return lockCount.l;\
+ };\
+ ULONG STDMETHODCALLTYPE cls::ReleaseLock()\
+ {\
+ if (lockCount.l > 0)\
+ {\
+ InterlockedDecrement(&lockCount.l);\
+ return lockCount.l;\
+ }\
+ else\
+ return 0;\
+ }\
+ DEFINE_OLE_BASE(cls)
+
+#define DEFINE_OLE_BASE(cls)\
+ void cls::_GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc)\
+ {\
+ *_interface = NULL;\
+ desc = NULL;
+
+#define OLE_INTERFACE(_iid, _type)\
+ if (IsEqualIID(iid, _iid))\
+ {\
+ *_interface = (IUnknown *) (_type *) self;\
+ desc = # _iid;\
+ return;\
+ }
+
+#define OLE_IINTERFACE(_face) OLE_INTERFACE(IID_##_face, _face)
+
+#define OLE_INTERFACE_CUSTOM(func)\
+ if (func(self, iid, _interface, desc))\
+ {\
+ return;\
+ }
+
+#define END_OLE_TABLE\
+ }
+
+
+class FrameSite :
+ public IOleClientSite,
+ public IOleInPlaceSiteEx,
+ public IOleInPlaceFrame,
+ public IOleItemContainer,
+ public IDispatch,
+ public IOleCommandTarget,
+ public IOleDocumentSite,
+ public IAdviseSink,
+ public IOleControlSite
+{
+private:
+ DECLARE_OLE_UNKNOWN(FrameSite);
+
+public:
+ FrameSite(wxWindow * win, wxActiveX * win2)
+ {
+ m_window = win2;
+ m_bSupportsWindowlessActivation = true;
+ m_bInPlaceLocked = false;
+ m_bUIActive = false;
+ m_bInPlaceActive = false;
+ m_bWindowless = false;
+
+ m_nAmbientLocale = 0;
+ m_clrAmbientForeColor = ::GetSysColor(COLOR_WINDOWTEXT);
+ m_clrAmbientBackColor = ::GetSysColor(COLOR_WINDOW);
+ m_bAmbientShowHatching = true;
+ m_bAmbientShowGrabHandles = true;
+ m_bAmbientAppearance = true;
+
+ m_hDCBuffer = NULL;
+ m_hWndParent = (HWND)win->GetHWND();
+ }
+ virtual ~FrameSite(){}
+ //***************************IDispatch*****************************
+ HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID, OLECHAR ** ,
+ unsigned int , LCID ,
+ DISPID * )
+ { return E_NOTIMPL; }
+ STDMETHOD(GetTypeInfo)(unsigned int, LCID, ITypeInfo **)
+ { return E_NOTIMPL; }
+ HRESULT STDMETHODCALLTYPE GetTypeInfoCount(unsigned int *)
+ { return E_NOTIMPL; }
+ HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID, LCID,
+ WORD wFlags, DISPPARAMS *,
+ VARIANT * pVarResult, EXCEPINFO *,
+ unsigned int *)
+ {
+ if (!(wFlags & DISPATCH_PROPERTYGET))
+ return S_OK;
+
+ if (pVarResult == NULL)
+ return E_INVALIDARG;
+
+ //The most common case is boolean, use as an initial type
+ V_VT(pVarResult) = VT_BOOL;
+
+ switch (dispIdMember)
+ {
+ case DISPID_AMBIENT_MESSAGEREFLECT:
+ V_BOOL(pVarResult)= FALSE;
+ return S_OK;
+
+ case DISPID_AMBIENT_DISPLAYASDEFAULT:
+ V_BOOL(pVarResult)= TRUE;
+ return S_OK;
+
+ case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
+ V_BOOL(pVarResult) = TRUE;
+ return S_OK;
+
+ case DISPID_AMBIENT_SILENT:
+ V_BOOL(pVarResult)= TRUE;
+ return S_OK;
+
+ case DISPID_AMBIENT_APPEARANCE:
+ pVarResult->vt = VT_BOOL;
+ pVarResult->boolVal = m_bAmbientAppearance;
+ break;
+
+ case DISPID_AMBIENT_FORECOLOR:
+ pVarResult->vt = VT_I4;
+ pVarResult->lVal = (long) m_clrAmbientForeColor;
+ break;
+
+ case DISPID_AMBIENT_BACKCOLOR:
+ pVarResult->vt = VT_I4;
+ pVarResult->lVal = (long) m_clrAmbientBackColor;
+ break;
+
+ case DISPID_AMBIENT_LOCALEID:
+ pVarResult->vt = VT_I4;
+ pVarResult->lVal = (long) m_nAmbientLocale;
+ break;
+
+ case DISPID_AMBIENT_USERMODE:
+ pVarResult->vt = VT_BOOL;
+ pVarResult->boolVal = m_window->m_bAmbientUserMode;
+ break;
+
+ case DISPID_AMBIENT_SHOWGRABHANDLES:
+ pVarResult->vt = VT_BOOL;
+ pVarResult->boolVal = m_bAmbientShowGrabHandles;
+ break;
+
+ case DISPID_AMBIENT_SHOWHATCHING:
+ pVarResult->vt = VT_BOOL;
+ pVarResult->boolVal = m_bAmbientShowHatching;
+ break;
+
+ default:
+ return DISP_E_MEMBERNOTFOUND;
+ }
+
+ return S_OK;
+ }
+
+ //**************************IOleWindow***************************
+ HRESULT STDMETHODCALLTYPE GetWindow(HWND * phwnd)
+ {
+ if (phwnd == NULL)
+ return E_INVALIDARG;
+ (*phwnd) = m_hWndParent;
+ return S_OK;
+ }
+ HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL)
+ {return S_OK;}
+ //**************************IOleInPlaceUIWindow*****************
+ HRESULT STDMETHODCALLTYPE GetBorder(LPRECT lprectBorder)
+ {
+ if (lprectBorder == NULL)
+ return E_INVALIDARG;
+ return INPLACE_E_NOTOOLSPACE;
+ }
+ HRESULT STDMETHODCALLTYPE RequestBorderSpace(LPCBORDERWIDTHS pborderwidths)
+ {
+ if (pborderwidths == NULL)
+ return E_INVALIDARG;
+ return INPLACE_E_NOTOOLSPACE;
+ }
+ HRESULT STDMETHODCALLTYPE SetBorderSpace(LPCBORDERWIDTHS)
+ {return S_OK;}
+ HRESULT STDMETHODCALLTYPE SetActiveObject(
+ IOleInPlaceActiveObject *pActiveObject, LPCOLESTR)
+ {
+ if (pActiveObject)
+ pActiveObject->AddRef();
+
+ m_window->m_oleInPlaceActiveObject = pActiveObject;
+ return S_OK;
+ }
+
+ //********************IOleInPlaceFrame************************
+
+ STDMETHOD(InsertMenus)(HMENU, LPOLEMENUGROUPWIDTHS){return S_OK;}
+ STDMETHOD(SetMenu)(HMENU, HOLEMENU, HWND){ return S_OK;}
+ STDMETHOD(RemoveMenus)(HMENU){return S_OK;}
+ STDMETHOD(SetStatusText)(LPCOLESTR){ return S_OK;}
+ HRESULT STDMETHODCALLTYPE EnableModeless(BOOL){return S_OK;}
+ HRESULT STDMETHODCALLTYPE TranslateAccelerator(LPMSG lpmsg, WORD)
+ {
+ // TODO: send an event with this id
+ if (m_window->m_oleInPlaceActiveObject.Ok())
+ m_window->m_oleInPlaceActiveObject->TranslateAccelerator(lpmsg);
+ return S_FALSE;
+ }
+
+ //*******************IOleInPlaceSite**************************
+ HRESULT STDMETHODCALLTYPE CanInPlaceActivate(){return S_OK;}
+ HRESULT STDMETHODCALLTYPE OnInPlaceActivate()
+ { m_bInPlaceActive = true; return S_OK; }
+ HRESULT STDMETHODCALLTYPE OnUIActivate()
+ { m_bUIActive = true; return S_OK; }
+ HRESULT STDMETHODCALLTYPE GetWindowContext(IOleInPlaceFrame **ppFrame,
+ IOleInPlaceUIWindow **ppDoc,
+ LPRECT lprcPosRect,
+ LPRECT lprcClipRect,
+ LPOLEINPLACEFRAMEINFO lpFrameInfo)
+ {
+ if (ppFrame == NULL || ppDoc == NULL || lprcPosRect == NULL ||
+ lprcClipRect == NULL || lpFrameInfo == NULL)
+ {
+ if (ppFrame != NULL)
+ (*ppFrame) = NULL;
+ if (ppDoc != NULL)
+ (*ppDoc) = NULL;
+ return E_INVALIDARG;
+ }
+
+ HRESULT hr = QueryInterface(IID_IOleInPlaceFrame, (void **) ppFrame);
+ if (! SUCCEEDED(hr))
+ {
+ return E_UNEXPECTED;
+ };
+
+ hr = QueryInterface(IID_IOleInPlaceUIWindow, (void **) ppDoc);
+ if (! SUCCEEDED(hr))
+ {
+ (*ppFrame)->Release();
+ *ppFrame = NULL;
+ return E_UNEXPECTED;
+ };
+
+ RECT rect;
+ ::GetClientRect(m_hWndParent, &rect);
+ if (lprcPosRect)
+ {
+ lprcPosRect->left = lprcPosRect->top = 0;
+ lprcPosRect->right = rect.right;
+ lprcPosRect->bottom = rect.bottom;
+ };
+ if (lprcClipRect)
+ {
+ lprcClipRect->left = lprcClipRect->top = 0;
+ lprcClipRect->right = rect.right;
+ lprcClipRect->bottom = rect.bottom;
+ };
+
+ memset(lpFrameInfo, 0, sizeof(OLEINPLACEFRAMEINFO));
+ lpFrameInfo->cb = sizeof(OLEINPLACEFRAMEINFO);
+ lpFrameInfo->hwndFrame = m_hWndParent;
+
+ return S_OK;
+ }
+ HRESULT STDMETHODCALLTYPE Scroll(SIZE){return S_OK;}
+ HRESULT STDMETHODCALLTYPE OnUIDeactivate(BOOL)
+ { m_bUIActive = false; return S_OK; }
+ HRESULT STDMETHODCALLTYPE OnInPlaceDeactivate()
+ { m_bInPlaceActive = false; return S_OK; }
+ HRESULT STDMETHODCALLTYPE DiscardUndoState(){return S_OK;}
+ HRESULT STDMETHODCALLTYPE DeactivateAndUndo(){return S_OK; }
+ HRESULT STDMETHODCALLTYPE OnPosRectChange(LPCRECT lprcPosRect)
+ {
+ if (m_window->m_oleInPlaceObject.Ok() && lprcPosRect)
+ {
+ m_window->m_oleInPlaceObject->SetObjectRects(
+ lprcPosRect, lprcPosRect);
+ }
+ return S_OK;
+ }
+ //*************************IOleInPlaceSiteEx***********************
+ HRESULT STDMETHODCALLTYPE OnInPlaceActivateEx(BOOL * pfNoRedraw, DWORD)
+ {
+ OleLockRunning(m_window->m_ActiveX, TRUE, FALSE);
+ if (pfNoRedraw)
+ (*pfNoRedraw) = FALSE;
+ return S_OK;
+ }
+
+ HRESULT STDMETHODCALLTYPE OnInPlaceDeactivateEx(BOOL)
+ {
+ OleLockRunning(m_window->m_ActiveX, FALSE, FALSE);
+ return S_OK;
+ }
+ STDMETHOD(RequestUIActivate)(){ return S_OK;}
+ //*************************IOleClientSite**************************
+ HRESULT STDMETHODCALLTYPE SaveObject(){return S_OK;}
+ const char *OleGetMonikerToStr(DWORD dwAssign)
+ {
+ switch (dwAssign)
+ {
+ case OLEGETMONIKER_ONLYIFTHERE : return "OLEGETMONIKER_ONLYIFTHERE";
+ case OLEGETMONIKER_FORCEASSIGN : return "OLEGETMONIKER_FORCEASSIGN";
+ case OLEGETMONIKER_UNASSIGN : return "OLEGETMONIKER_UNASSIGN";
+ case OLEGETMONIKER_TEMPFORUSER : return "OLEGETMONIKER_TEMPFORUSER";
+ default : return "Bad Enum";
+ };
+ };
+
+ const char *OleGetWhicMonikerStr(DWORD dwWhichMoniker)
+ {
+ switch(dwWhichMoniker)
+ {
+ case OLEWHICHMK_CONTAINER : return "OLEWHICHMK_CONTAINER";
+ case OLEWHICHMK_OBJREL : return "OLEWHICHMK_OBJREL";
+ case OLEWHICHMK_OBJFULL : return "OLEWHICHMK_OBJFULL";
+ default : return "Bad Enum";
+ };
+ };
+ STDMETHOD(GetMoniker)(DWORD, DWORD, IMoniker **){return E_FAIL;}
+ HRESULT STDMETHODCALLTYPE GetContainer(LPOLECONTAINER * ppContainer)
+ {
+ if (ppContainer == NULL)
+ return E_INVALIDARG;
+ HRESULT hr = QueryInterface(
+ IID_IOleContainer, (void**)(ppContainer));
+ wxASSERT(SUCCEEDED(hr));
+ return hr;
+ }
+ HRESULT STDMETHODCALLTYPE ShowObject()
+ {
+ if (m_window->m_oleObjectHWND)
+ ::ShowWindow(m_window->m_oleObjectHWND, SW_SHOW);
+ return S_OK;
+ }
+ STDMETHOD(OnShowWindow)(BOOL){return S_OK;}
+ STDMETHOD(RequestNewObjectLayout)(){return E_NOTIMPL;}
+ //********************IParseDisplayName***************************
+ HRESULT STDMETHODCALLTYPE ParseDisplayName(
+ IBindCtx *, LPOLESTR, ULONG *, IMoniker **){return E_NOTIMPL;}
+ //********************IOleContainer*******************************
+ STDMETHOD(EnumObjects)(DWORD, IEnumUnknown **){return E_NOTIMPL;}
+ HRESULT STDMETHODCALLTYPE LockContainer(BOOL){return S_OK;}
+ //********************IOleItemContainer***************************
+ HRESULT STDMETHODCALLTYPE
+ #ifdef _UNICODE
+ GetObjectW
+ #else
+ GetObjectA
+ #endif
+ (LPOLESTR pszItem, DWORD, IBindCtx *, REFIID, void ** ppvObject)
+ {
+ if (pszItem == NULL || ppvObject == NULL)
+ return E_INVALIDARG;
+ *ppvObject = NULL;
+ return MK_E_NOOBJECT;
+ }
+ HRESULT STDMETHODCALLTYPE GetObjectStorage(
+ LPOLESTR pszItem, IBindCtx * , REFIID, void ** ppvStorage)
+ {
+ if (pszItem == NULL || ppvStorage == NULL)
+ return E_INVALIDARG;
+ *ppvStorage = NULL;
+ return MK_E_NOOBJECT;
+ }
+ HRESULT STDMETHODCALLTYPE IsRunning(LPOLESTR pszItem)
+ {
+ if (pszItem == NULL)
+ return E_INVALIDARG;
+ return MK_E_NOOBJECT;
+ }
+ //***********************IOleControlSite*****************************
+ HRESULT STDMETHODCALLTYPE OnControlInfoChanged()
+ {return S_OK;}
+ HRESULT STDMETHODCALLTYPE LockInPlaceActive(BOOL fLock)
+ {
+ m_bInPlaceLocked = (fLock) ? true : false;
+ return S_OK;
+ }
+ HRESULT STDMETHODCALLTYPE GetExtendedControl(IDispatch **)
+ {return E_NOTIMPL;}
+ HRESULT STDMETHODCALLTYPE TransformCoords(
+ POINTL * pPtlHimetric, POINTF * pPtfContainer, DWORD)
+ {
+ if (pPtlHimetric == NULL || pPtfContainer == NULL)
+ return E_INVALIDARG;
+ return E_NOTIMPL;
+ }
+ HRESULT STDMETHODCALLTYPE TranslateAccelerator(LPMSG, DWORD)
+ {return E_NOTIMPL;}
+ HRESULT STDMETHODCALLTYPE OnFocus(BOOL){return S_OK;}
+ HRESULT STDMETHODCALLTYPE ShowPropertyFrame(){return E_NOTIMPL;}
+ //**************************IOleCommandTarget***********************
+ HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *, ULONG cCmds,
+ OLECMD prgCmds[], OLECMDTEXT *)
+ {
+ if (prgCmds == NULL) return E_INVALIDARG;
+ for (ULONG nCmd = 0; nCmd < cCmds; nCmd++)
+ {
+ // unsupported by default
+ prgCmds[nCmd].cmdf = 0;
+ }
+ return OLECMDERR_E_UNKNOWNGROUP;
+ }
+
+ HRESULT STDMETHODCALLTYPE Exec(const GUID *, DWORD,
+ DWORD, VARIANTARG *, VARIANTARG *)
+ {return OLECMDERR_E_NOTSUPPORTED;}
+
+ //**********************IAdviseSink************************************
+ void STDMETHODCALLTYPE OnDataChange(FORMATETC *, STGMEDIUM *) {}
+ void STDMETHODCALLTYPE OnViewChange(DWORD, LONG) {}
+ void STDMETHODCALLTYPE OnRename(IMoniker *){}
+ void STDMETHODCALLTYPE OnSave(){}
+ void STDMETHODCALLTYPE OnClose(){}
+
+ //**********************IOleDocumentSite***************************
+ HRESULT STDMETHODCALLTYPE ActivateMe(
+ IOleDocumentView __RPC_FAR *pViewToActivate)
+ {
+ wxAutoIOleInPlaceSite inPlaceSite(
+ IID_IOleInPlaceSite, (IDispatch *) this);
+ if (!inPlaceSite.Ok())
+ return E_FAIL;
+
+ if (pViewToActivate)
+ {
+ m_window->m_docView = pViewToActivate;
+ m_window->m_docView->SetInPlaceSite(inPlaceSite);
+ }
+ else
+ {
+ wxAutoIOleDocument oleDoc(
+ IID_IOleDocument, m_window->m_oleObject);
+ if (! oleDoc.Ok())
+ return E_FAIL;
+
+ HRESULT hr = oleDoc->CreateView(inPlaceSite, NULL,
+ 0, m_window->m_docView.GetRef());
+ if (hr != S_OK)
+ return E_FAIL;
+
+ m_window->m_docView->SetInPlaceSite(inPlaceSite);
+ };
+
+ m_window->m_docView->UIActivate(TRUE);
+ return S_OK;
+ };
+
+
+protected:
+ wxActiveX * m_window;
+
+ HDC m_hDCBuffer;
+ HWND m_hWndParent;
+
+ bool m_bSupportsWindowlessActivation;
+ bool m_bInPlaceLocked;
+ bool m_bInPlaceActive;
+ bool m_bUIActive;
+ bool m_bWindowless;
+
+ LCID m_nAmbientLocale;
+ COLORREF m_clrAmbientForeColor;
+ COLORREF m_clrAmbientBackColor;
+ bool m_bAmbientShowHatching;
+ bool m_bAmbientShowGrabHandles;
+ bool m_bAmbientAppearance;
+};
+
+DEFINE_OLE_TABLE(FrameSite)
+ OLE_INTERFACE(IID_IUnknown, IOleClientSite)
+ OLE_IINTERFACE(IOleClientSite)
+ OLE_INTERFACE(IID_IOleWindow, IOleInPlaceSite)
+ OLE_IINTERFACE(IOleInPlaceSite)
+ OLE_IINTERFACE(IOleInPlaceSiteEx)
+ OLE_IINTERFACE(IOleInPlaceUIWindow)
+ OLE_IINTERFACE(IOleInPlaceFrame)
+ OLE_IINTERFACE(IParseDisplayName)
+ OLE_IINTERFACE(IOleContainer)
+ OLE_IINTERFACE(IOleItemContainer)
+ OLE_IINTERFACE(IDispatch)
+ OLE_IINTERFACE(IOleCommandTarget)
+ OLE_IINTERFACE(IOleDocumentSite)
+ OLE_IINTERFACE(IAdviseSink)
+ OLE_IINTERFACE(IOleControlSite)
+END_OLE_TABLE;
+
+
+wxActiveX::wxActiveX(wxWindow * parent, REFIID iid, IUnknown* pUnk)
+ : m_realparent(parent)
+{
+ m_bAmbientUserMode = true;
+ m_docAdviseCookie = 0;
+ CreateActiveX(iid, pUnk);
+}
+
+wxActiveX::~wxActiveX()
+{
+ // disconnect connection points
+ if (m_oleInPlaceObject.Ok())
+ {
+ m_oleInPlaceObject->InPlaceDeactivate();
+ m_oleInPlaceObject->UIDeactivate();
+ }
+
+ if (m_oleObject.Ok())
+ {
+ if (m_docAdviseCookie != 0)
+ m_oleObject->Unadvise(m_docAdviseCookie);
+
+ m_oleObject->DoVerb(
+ OLEIVERB_HIDE, NULL, m_clientSite, 0, (HWND) GetHWND(), NULL);
+ m_oleObject->Close(OLECLOSE_NOSAVE);
+ m_oleObject->SetClientSite(NULL);
+ }
+}
+
+void wxActiveX::CreateActiveX(REFIID iid, IUnknown* pUnk)
+{
+ HRESULT hret;
+ hret = m_ActiveX.QueryInterface(iid, pUnk);
+ wxASSERT(SUCCEEDED(hret));
+
+ // FrameSite
+ FrameSite *frame = new FrameSite(m_realparent, this);
+ // oleClientSite
+ hret = m_clientSite.QueryInterface(
+ IID_IOleClientSite, (IDispatch *) frame);
+ wxASSERT(SUCCEEDED(hret));
+ // adviseSink
+ wxAutoIAdviseSink adviseSink(IID_IAdviseSink, (IDispatch *) frame);
+ wxASSERT(adviseSink.Ok());
+
+ // Get Dispatch interface
+ hret = m_Dispatch.QueryInterface(IID_IDispatch, m_ActiveX);
+
+ // Get IOleObject interface
+ hret = m_oleObject.QueryInterface(IID_IOleObject, m_ActiveX);
+ wxASSERT(SUCCEEDED(hret));
+
+ // get IViewObject Interface
+ hret = m_viewObject.QueryInterface(IID_IViewObject, m_ActiveX);
+ wxASSERT(SUCCEEDED(hret));
+
+ // document advise
+ m_docAdviseCookie = 0;
+ hret = m_oleObject->Advise(adviseSink, &m_docAdviseCookie);
+ m_oleObject->SetHostNames(L"wxActiveXContainer", NULL);
+ OleSetContainedObject(m_oleObject, TRUE);
+ OleRun(m_oleObject);
+
+
+ // Get IOleInPlaceObject interface
+ hret = m_oleInPlaceObject.QueryInterface(
+ IID_IOleInPlaceObject, m_ActiveX);
+ wxASSERT(SUCCEEDED(hret));
+
+ // status
+ DWORD dwMiscStatus;
+ m_oleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);
+ wxASSERT(SUCCEEDED(hret));
+
+ // set client site first ?
+ if (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)
+ m_oleObject->SetClientSite(m_clientSite);
+
+
+ // stream init
+ wxAutoIPersistStreamInit
+ pPersistStreamInit(IID_IPersistStreamInit, m_oleObject);
+
+ if (pPersistStreamInit.Ok())
+ {
+ hret = pPersistStreamInit->InitNew();
+ }
+
+ if (! (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST))
+ m_oleObject->SetClientSite(m_clientSite);
+
+
+ RECT posRect;
+ ::GetClientRect((HWND)m_realparent->GetHWND(), &posRect);
+
+ m_oleObjectHWND = 0;
+
+ if (m_oleInPlaceObject.Ok())
+ {
+ hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
+ if (SUCCEEDED(hret))
+ ::SetActiveWindow(m_oleObjectHWND);
+ }
+
+
+ if (! (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME))
+ {
+ if (posRect.right > 0 && posRect.bottom > 0 &&
+ m_oleInPlaceObject.Ok())
+ m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
+
+ hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL,
+ m_clientSite, 0, (HWND)m_realparent->GetHWND(), &posRect);
+ hret = m_oleObject->DoVerb(OLEIVERB_SHOW, 0, m_clientSite, 0,
+ (HWND)m_realparent->GetHWND(), &posRect);
+ }
+
+ if (! m_oleObjectHWND && m_oleInPlaceObject.Ok())
+ {
+ hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
+ }
+
+ if (m_oleObjectHWND)
+ {
+ ::SetActiveWindow(m_oleObjectHWND);
+ ::ShowWindow(m_oleObjectHWND, SW_SHOW);
+
+ this->AssociateHandle(m_oleObjectHWND);
+ this->Reparent(m_realparent);
+
+ wxWindow* pWnd = m_realparent;
+ int id = m_realparent->GetId();
+
+ pWnd->Connect(id, wxEVT_SIZE,
+ wxSizeEventHandler(wxActiveX::OnSize), 0, this);
+ pWnd->Connect(id, wxEVT_SET_FOCUS,
+ wxFocusEventHandler(wxActiveX::OnSetFocus), 0, this);
+ pWnd->Connect(id, wxEVT_KILL_FOCUS,
+ wxFocusEventHandler(wxActiveX::OnKillFocus), 0, this);
+ }
+}
+
+#define HIMETRIC_PER_INCH 2540
+#define MAP_PIX_TO_LOGHIM(x,ppli) MulDiv(HIMETRIC_PER_INCH, (x), (ppli))