Commit 93a81bed authored by Damien Fouilleul's avatar Damien Fouilleul

Initial version of ActiveX plugin for VLC

parents
###############################################################################
# Building the Activex plugin
###############################################################################
noinst_LIBRARIES = $(noinst_LIBRARIES_activex)
MOSTLYCLEANFILES = $(LIBRARIES_activex)
EXTRA_DIST = $(SOURCES_activex) $(DIST_rsrc)
BUILT_SOURCES = $(BUILT_SOURCES_activex)
SOURCES_activex = \
main.cpp \
utils.cpp \
utils.h \
olecontrol.cpp \
olecontrol.h \
oleinplaceactiveobject.cpp \
oleinplaceactiveobject.h \
oleinplaceobject.cpp \
oleinplaceobject.h \
oleobject.cpp \
oleobject.h \
persistpropbag.cpp \
persistpropbag.h \
persiststorage.cpp \
persiststorage.h \
persiststreaminit.cpp \
persiststreaminit.h \
provideclassinfo.cpp \
provideclassinfo.h \
connectioncontainer.cpp \
connectioncontainer.h \
objectsafety.cpp \
objectsafety.h \
vlccontrol.cpp \
vlccontrol.h \
plugin.cpp \
plugin.h \
axvlc_idl.c \
axvlc_idl.h \
$(NULL)
DIST_rsrc = \
axvlc_rc.rc \
$(NULL)
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
noinst_LIBRARIES_activex = libaxvlc.a
axvlc_DATA = axvlc$(LIBEXT)
axvlcdir = $(libdir)
LDFLAGS_activex = `$(VLC_CONFIG) --libs vlc activex builtin`
libaxvlc_a_SOURCES = $(SOURCES_activex) $(SOURCE_dll)
libaxvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags activex`
libaxvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags activex`
libaxvlc_a_DEPENDENCIES = axvlc.def $(DATA_axvlc_rc)
axvlc$(LIBEXT): $(libaxvlc_a_OBJECTS) \
$(libaxvlc_a_DEPENDENCIES) stamp-pic
$(CXXLINK) $(libaxvlc_a_OBJECTS) $(DATA_axvlc_rc) -Wl,--enable-stdcall-fixup axvlc.def \
$(LIBRARIES_libvlc) -shared $(LDFLAGS_activex)
DATA_axvlc_tlb = $(axvlc_tlb_DATA)
noinst_axvlc_tlb_DATA = axvlc.tlb
noinst_axvlc_tlbdir = $(libdir)
if HAS_MIDL_COMPILER
axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
$(MIDL) -Oicf -error all -env win32 -tlb axvlc.tlb -iid axvlc_idl.c -h axvlc_idl.h axvlc.idl
clean-tlb:
-rm axvlc.tlb axvlc_idl.c axvlc_idl.h
else
clean-tlb:
endif
DATA_axvlc_rc = $(noinst_axvlc_rc_DATA)
noinst_axvlc_rc_DATA = axvlc_rc.$(OBJEXT)
noinst_axvlc_rcdir = $(libdir)
axvlc_rc.$(OBJEXT): axvlc_rc.rc inplace.bmp $(axvlc_tlb_DATA)
$(WINDRES) -DVERSION=$(VERSION) -DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` --include-dir $(srcdir) -i $< -o $@
###############################################################################
# Stamp rules
###############################################################################
clean-stamp:
rm -f stamp-pic
stamp-pic: FORCE
@for dep in "" `$(VLC_CONFIG) --target builtin`; do \
if test "$${dep}" -nt "$(LIBRARIES_activex)"; then \
rm -f $@; \
break; \
fi; \
done
@if test ! -f $@; then printf "" > $@; fi
###############################################################################
# Clean rules
###############################################################################
clean-local: clean-stamp clean-tlb
-rm axvlc$(LIBEXT)
###############################################################################
# Force rule
###############################################################################
FORCE:
== ACTIVEX Control for VLC ==
The VLC ActiveX Control has been primary designed to work with Internet Explorer.
however it may also work with Visual Basic and/or .NET
Please note, that this code does not rely upon MFC/ATL, hence good compatibility
is not guaranteed
== Compiling ==
In order to script the ActiveX Control on Internet Explorer, a type library is required.
This type library is usually generated from an IDL file using Microsoft MIDL compiler.
However, for convenience I have checked in the output of the MIDL compiler in the
repository so that you will only need the MIDL compiler if you change axvlc.idl.
the generated files are as follow:
axvlc_idl.c
axvlc_idl.h
axvlc.tlb
To use the MIDL compiler on cygwin, you will need to set some environment variables
before configuring vlc. If you have a copy of 'Microsoft Visual C++ 6.0' installed,
the following settings are correct:
export PATH=$PATH:"/cygdrive/c/Program Files/Microsoft Visual Studio/COMMON/MSDev98/Bin":"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/Bin"
export INCLUDE='C:\Program Files\Microsoft Visual Studio\VC98\Include'
export MIDL="midl"
if you are cross-compiling on Linux, you may be able to use 'widl' which is part of
the WINE project (http://www.winehq.com), however I have not tested it.
== Installing ==
The ActiveX control is built as axvlc.dll, which is the only file that needs be
distributed and it may be installed anywhere on the target machine as long as
its path is correct within the registry.
the necessary registry settings are stored in axvlc.reg
in order to use the plugin, you will need to VLC properly installed on your system
otherwise make sure that the plugin path is set in the registry as indicated below
[HKEY_LOCAL_MACHINE\Software\VideoLAN\VLC]
InstallDir="path\\dir\\"
regards,
Damien Fouilleul <Damien dot Fouilleul at laposte dot net>
LIBRARY AXVLC.DLL
EXPORTS
CLSID_VLCPlugin data
DllMain DllMain@12
DllCanUnloadNow DllCanUnloadNow@0
DllGetClassObject DllGetClassObject@12
DllRegisterServer DllRegisterServer@0
DllUnregisterServer DllUnregisterServer@0
/*****************************************************************************
* axvlc.idl: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
[
uuid(DF2BBE39-40A8-433b-A279-073F48DA94B6),
version(1.0),
helpstring("VideoLAN VLC ActiveX Plugin"),
]
library AXVLC
{
importlib("stdole2.tlb");
// Forward declare all types defined in this typelib
interface IVLCControl;
dispinterface DVLCEvents;
enum VLCPlaylistMode {
VLCPlayListInsert = 1,
VLCPlayListReplace = 2,
VLCPlayListAppend = 4,
VLCPlayListGo = 8,
VLCPlayListCheckInsert = 16
};
// playlist target position
const int VLCPlayListEnd = -666;
[
odl,
uuid(C2FA41D0-B113-476e-AC8C-9BD14999C1C1),
helpstring("VLC Control"),
dual,
hidden,
oleautomation
]
interface IVLCControl : IDispatch {
[id(0), bindable, defaultbind, propget, helpstring("Specifies current target in playlist")]
HRESULT Value([out, retval] VARIANT* pvarValue);
[id(0), bindable, defaultbind, propput, helpstring("Specifies current target in playlist")]
HRESULT Value([in] VARIANT pvarValue);
[propget, bindable, helpstring("Shows or hides plugin.")]
HRESULT Visible([out, retval] VARIANT_BOOL* visible);
[propput, bindable, helpstring("Shows or hides plugin.")]
HRESULT Visible([in] VARIANT_BOOL visible);
[helpstring("Play current target in playlist.")]
HRESULT play();
[helpstring("Pause playback.")]
HRESULT pause();
[helpstring("Stop playback.")]
HRESULT stop();
[propget, helpstring("Specifies whether VLC is playing.")]
HRESULT Playing([out, retval] VARIANT_BOOL* isPlaying);
[propput, helpstring("Specifies whether VLC is playing.")]
HRESULT Playing([in] VARIANT_BOOL isPlaying);
[propget, helpstring("Specifies playback position within current target in playlist, position is a relative value ranging from 0.0 to 1.0.")]
HRESULT Position([out, retval] float* position);
[propput, helpstring("Specifies playback position within current target in playlist, position is a relative value ranging from 0.0 to 1.0.")]
HRESULT Position([in] float position);
[propget, helpstring("Specifies playback time relative to the start of current target in playlist.")]
HRESULT Time([out, retval] int* seconds);
[propput, helpstring("Specifies playback time relative to the start of current target in playlist.")]
HRESULT Time([in] int seconds);
[helpstring("Advance or backtrack playback time, relative to current time.")]
HRESULT shuttle([in] int seconds);
[helpstring("Switch between normal and fullscreen video.")]
HRESULT fullscreen();
[propget, helpstring("Returns total length in seconds of current target in playlist, may be unknown.")]
HRESULT Length([out, retval] int* seconds);
[helpstring("Increases playback speed, one of 1x, 2x, 4x, 8x.")]
HRESULT playFaster();
[helpstring("Decreases playback speed, one of 1x, 2x, 4x, 8x.")]
HRESULT playSlower();
[propget, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]
HRESULT Volume([out, retval] int* volume);
[propput, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]
HRESULT Volume([in] int volume);
[helpstring("Mute/unmute playback sound volume.")]
HRESULT toggleMute();
[helpstring("Add a target to the current playlist.")]
/*
** use VARIANT rather than a SAFEARRAY as argument type
** for compatibility with some scripting language (JScript)
*/
HRESULT addTarget([in] BSTR uri, [in] VARIANT options, [in] enum VLCPlaylistMode mode, [in] int position);
[propget, helpstring("Returns index of current target in playlist.")]
HRESULT PlaylistIndex([out, retval] int* index);
[propget, helpstring("Returns number of items in playlist.")]
HRESULT PlaylistCount([out, retval] int* index);
[helpstring("Advance to next item in playlist.")]
HRESULT playlistNext();
[helpstring("Advance to previous item in playlist.")]
HRESULT playlistPrev();
[helpstring("Remove all items from playlist.")]
HRESULT playlistClear();
[propget, helpstring("Returns VLC Version.")]
HRESULT VersionInfo([out, retval] BSTR* version);
};
[
uuid(DF48072F-5EF8-434e-9B40-E2F3AE759B5F),
helpstring("Event interface for VLC control"),
hidden
]
dispinterface DVLCEvents {
properties:
methods:
[id(1), helpstring("Playback in progress")]
void OnPlay();
[id(2), helpstring("Playback has paused")]
void OnPause();
[id(3), helpstring("Playback has stopped")]
void OnStop();
};
[
uuid(E23FE9C6-778E-49D4-B537-38FCDE4887D8),
helpstring("VLC control"),
control
]
coclass VLCPlugin {
[default] interface IVLCControl;
[default, source] dispinterface DVLCEvents;
};
};
REGEDIT4
[HKEY_CLASSES_ROOT\VideoLAN.VLCPlugin]
@="VideoLAN VLC ActiveX Plugin"
[HKEY_CLASSES_ROOT\VideoLAN.VLCPlugin\CLSID]
@="{E23FE9C6-778E-49d4-B537-38FCDE4887D8}"
[HKEY_CLASSES_ROOT\VideoLAN.VLCPlugin.1]
@="VideoLAN VLC ActiveX Plugin"
[HKEY_CLASSES_ROOT\VideoLAN.VLCPlugin.1\CLSID]
@="{E23FE9C6-778E-49d4-B537-38FCDE4887D8}"
[HKEY_CLASSES_ROOT\AppID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}]
@="VideoLAN VLC ActiveX Plugin"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}]
@="VideoLAN VLC ActiveX Plugin"
"AppID"="{E23FE9C6-778E-49d4-B537-38FCDE4887D8}"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\ProgID]
@="VideoLAN.VLCPlugin.1"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\VersionIndependentProgID]
@="VideoLAN.VLCPlugin"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\InprocServer32]
@="axvlc.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Implemented Categories\{40FC6ED4-2438-11CF-A3DB-080036F12502}]
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Implemented Categories\{40FC6ED5-2438-11CF-A3DB-080036F12502}]
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Implemented Categories\{7DD95801-9882-11CF-9FA9-00AA006C42C4}]
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Implemented Categories\{7DD95802-9882-11CF-9FA9-00AA006C42C4}]
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Version]
@="1.0"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Control]
@=""
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Insertable]
@=""
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\MiscStatus]
@="0"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\MiscStatus\1]
@="131473"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\TypeLib]
@="{DF2BBE39-40A8-433b-A279-073F48DA94B6}"
[HKEY_CLASSES_ROOT\TypeLib\{DF2BBE39-40A8-433b-A279-073F48DA94B6}\1.0]
@="VideoLAN VLC ActiveX Plugin"
[HKEY_CLASSES_ROOT\TypeLib\{DF2BBE39-40A8-433b-A279-073F48DA94B6}\1.0\0\win32]
@="axvlc.dll"
[HKEY_CLASSES_ROOT\TypeLib\{DF2BBE39-40A8-433b-A279-073F48DA94B6}\1.0\FLAGS]
@="2"
File added
/*****************************************************************************
* axvlc_idl.c: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
const IID LIBID_AXVLC = {0xDF2BBE39,0x40A8,0x433b,{0xA2,0x79,0x07,0x3F,0x48,0xDA,0x94,0xB6}};
const IID IID_IVLCControl = {0xC2FA41D0,0xB113,0x476e,{0xAC,0x8C,0x9B,0xD1,0x49,0x99,0xC1,0xC1}};
const IID DIID_DVLCEvents = {0xDF48072F,0x5EF8,0x434e,{0x9B,0x40,0xE2,0xF3,0xAE,0x75,0x9B,0x5F}};
const CLSID CLSID_VLCPlugin = {0xE23FE9C6,0x778E,0x49D4,{0xB5,0x37,0x38,0xFC,0xDE,0x48,0x87,0xD8}};
#ifdef __cplusplus
}
#endif
This diff is collapsed.
#ifndef VERSION_NUMBER
#define VERSION_NUMBER 0,0,0,0
#endif
#ifndef VERSION
#define VERSION 0.0.0
#endif
#define STRINGIFY( z ) UGLY_KLUDGE( z )
#define UGLY_KLUDGE( z ) #z
1 VERSIONINFO
FILETYPE 1
FILEOS 4
PRODUCTVERSION VERSION_NUMBER
FILEVERSION VERSION_NUMBER
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "VideoLAN Team"
VALUE "FileVersion", STRINGIFY( VERSION )
VALUE "FileDescription", "VLC media player"
VALUE "LegalCopyright", "(c) 1996-2003 VideoLAN"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
INPLACE-PICT BITMAP DISCARDABLE "inplace.bmp"
1 TYPELIB "axvlc.tlb"
/*****************************************************************************
* connectioncontainer.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "connectioncontainer.h"
#include "utils.h"
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumConnections : public IEnumConnections
{
public:
VLCEnumConnections(vector<CONNECTDATA> &v) :
e(VLCEnum<CONNECTDATA>(IID_IEnumConnections, v))
{ e.setRetainOperation((VLCEnum<CONNECTDATA>::retainer)&retain); };
VLCEnumConnections(const VLCEnumConnections &vlcEnum) : e(vlcEnum.e) {};
virtual ~VLCEnumConnections() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ return e.QueryInterface(riid, ppv); };
STDMETHODIMP_(ULONG) AddRef(void)
{ return e.AddRef(); };
STDMETHODIMP_(ULONG) Release(void)
{return e.Release(); };
//IEnumConnectionPoints
STDMETHODIMP Next(ULONG celt, LPCONNECTDATA rgelt, ULONG *pceltFetched)
{ return e.Next(celt, rgelt, pceltFetched); };
STDMETHODIMP Skip(ULONG celt)
{ return e.Skip(celt);};
STDMETHODIMP Reset(void)
{ return e.Reset();};
STDMETHODIMP Clone(LPENUMCONNECTIONS *ppenum)
{ if( NULL == ppenum ) return E_POINTER;
*ppenum = dynamic_cast<LPENUMCONNECTIONS>(new VLCEnumConnections(*this));
return (NULL != *ppenum) ? S_OK : E_OUTOFMEMORY;
};
private:
static void retain(CONNECTDATA cd)
{
cd.pUnk->AddRef();
};
VLCEnum<CONNECTDATA> e;
};
////////////////////////////////////////////////////////////////////////////////////////////////
STDMETHODIMP VLCConnectionPoint::GetConnectionInterface(IID *iid)
{
if( NULL == iid )
return E_POINTER;
*iid = _iid;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *ppCPC)
{
if( NULL == ppCPC )
return E_POINTER;
_p_cpc->AddRef();
*ppCPC = _p_cpc;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
{
if( (NULL == pUnk) || (NULL == pdwCookie) )
return E_POINTER;
CONNECTDATA cd;
pUnk->AddRef();
cd.pUnk = pUnk;
*pdwCookie = cd.dwCookie = _connections.size();
_connections.push_back(cd);
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
{
if( pdwCookie < _connections.size() )
{
CONNECTDATA cd = _connections[pdwCookie];
if( NULL != cd.pUnk )
{
cd.pUnk->Release();
cd.pUnk = NULL;
return S_OK;
}
}
return CONNECT_E_NOCONNECTION;
};
STDMETHODIMP VLCConnectionPoint::EnumConnections(IEnumConnections **ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = dynamic_cast<LPENUMCONNECTIONS>(new VLCEnumConnections(_connections));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
void VLCConnectionPoint::fireEvent(DISPID dispId, LCID lcid, DISPPARAMS* pDispParams)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
{
IDispatch *pDisp;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
{
unsigned int puArgErr;
VARIANT vRes;
if( SUCCEEDED(pDisp->Invoke(dispId, IID_NULL, lcid, DISPATCH_METHOD, pDispParams, &vRes, NULL, &puArgErr)) )
{
VariantClear(&vRes);
}
pDisp->Release();
}
}
++iter;
}
};
void VLCConnectionPoint::firePropChangedEvent(DISPID dispId)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
{
IPropertyNotifySink *pPropSink;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IPropertyNotifySink, (LPVOID *)&pPropSink)) )
{
pPropSink->OnChanged(dispId);
pPropSink->Release();
}
}
++iter;
}
};
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumConnectionPoints : public IEnumConnectionPoints
{
public:
VLCEnumConnectionPoints(vector<LPCONNECTIONPOINT> &v) :
e(VLCEnum<LPCONNECTIONPOINT>(IID_IEnumConnectionPoints, v))
{ e.setRetainOperation((VLCEnum<LPCONNECTIONPOINT>::retainer)&retain); };
VLCEnumConnectionPoints(const VLCEnumConnectionPoints &vlcEnum) : e(vlcEnum.e) {};
virtual ~VLCEnumConnectionPoints() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ return e.QueryInterface(riid, ppv); };
STDMETHODIMP_(ULONG) AddRef(void)
{ return e.AddRef(); };
STDMETHODIMP_(ULONG) Release(void)
{return e.Release(); };
//IEnumConnectionPoints
STDMETHODIMP Next(ULONG celt, LPCONNECTIONPOINT *rgelt, ULONG *pceltFetched)
{ return e.Next(celt, rgelt, pceltFetched); };
STDMETHODIMP Skip(ULONG celt)
{ return e.Skip(celt);};
STDMETHODIMP Reset(void)
{ return e.Reset();};
STDMETHODIMP Clone(LPENUMCONNECTIONPOINTS *ppenum)
{ if( NULL == ppenum ) return E_POINTER;
*ppenum = dynamic_cast<LPENUMCONNECTIONPOINTS>(new VLCEnumConnectionPoints(*this));
return (NULL != *ppenum) ? S_OK : E_OUTOFMEMORY;
};
private:
static void retain(LPCONNECTIONPOINT cp)
{
cp->AddRef();
};
VLCEnum<LPCONNECTIONPOINT> e;
};
////////////////////////////////////////////////////////////////////////////////////////////////
VLCConnectionPointContainer::VLCConnectionPointContainer(VLCPlugin *p_instance) :
_p_instance(p_instance)
{
_p_events = new VLCConnectionPoint(dynamic_cast<LPCONNECTIONPOINTCONTAINER>(this),
_p_instance->getDispEventID());
_v_cps.push_back(dynamic_cast<LPCONNECTIONPOINT>(_p_events));
_p_props = new VLCConnectionPoint(dynamic_cast<LPCONNECTIONPOINTCONTAINER>(this),
IID_IPropertyNotifySink);
_v_cps.push_back(dynamic_cast<LPCONNECTIONPOINT>(_p_props));
};
VLCConnectionPointContainer::~VLCConnectionPointContainer()
{
_v_cps.clear();
delete _p_props;
delete _p_events;
};
STDMETHODIMP VLCConnectionPointContainer::EnumConnectionPoints(LPENUMCONNECTIONPOINTS *ppEnum)