Commit e1e2327f authored by Damien Fouilleul's avatar Damien Fouilleul

- miscelleanous fixes and improvements

- self registration (Internet installation now possible)
parent e9aab018
......@@ -38,21 +38,21 @@ SOURCES_activex = \
plugin.h \
axvlc_idl.c \
axvlc_idl.h \
$(NULL)
$(NULL)
DIST_rsrc = \
axvlc_rc.rc \
$(NULL)
axvlc_rc.rc \
$(NULL)
DIST_misc = \
README.TXT \
axvlc.def \
axvlc.idl \
axvlc.reg \
axvlc.tlb \
inplace.bmp \
test.html \
$(NULL)
README.TXT \
axvlc.def \
axvlc.idl \
axvlc.reg \
axvlc.tlb \
inplace.bmp \
test.html \
$(NULL)
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
......@@ -96,7 +96,7 @@ 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)
axvlc_rc.$(OBJEXT): axvlc_rc.rc inplace.bmp axvlc.tlb
$(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 $@
else
......
......@@ -3,13 +3,16 @@
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
is not guaranteed.
== Compiling ==
In order to script the ActiveX Control on Internet Explorer, a type library is required.
The Active Control should compile without any glitches as long as you have the latest
version of mingw gcc and headers. However, 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
Therefore, 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:
......@@ -28,18 +31,36 @@ 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 ==
== Local Install ==
The ActiveX control is built as axvlc.dll, which is the only file that needs be
The ActiveX control is built as a DLL file, 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
its path is specified within your PATH environment variable. Typically, you would
install it into your WINDOWS directory.
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
if the control needs other VLC plugins, you will need to have VLC 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\\"
WARNING: The plugins version must also match the ActiveX control version,
otherwise it may crash while attempting to load incompatible plugins
== Internet Install ==
The activex control may be installed from a remote through Internet Installer if
it is packaged up in a CAB file. The following link explains how to achieve this
http://msdn.microsoft.com/workshop/components/activex/packaging.asp
For convenience, I have provide a sample axvlc.INF file, which installs the ActiveX Control
into the WINDOWS directory, feel free to adapt it to your need.
WARNING: For remote install, the ActiveX Control should be built with all required VLC
plugins built-in.
regards,
Damien Fouilleul <Damien dot Fouilleul at laposte dot net>
......@@ -34,15 +34,27 @@ library AXVLC
dispinterface DVLCEvents;
enum VLCPlaylistMode {
VLCPlayListInsert = 1,
VLCPlayListReplace = 2,
VLCPlayListAppend = 4,
VLCPlayListGo = 8,
VLCPlayListCheckInsert = 16
VLCPlayListInsert = 1,
VLCPlayListReplace = 2,
VLCPlayListAppend = 4,
VLCPlayListGo = 8,
VLCPlayListCheckInsert = 16
};
// playlist target position
const int VLCPlayListEnd = -666;
const int VLCPlayListEnd = -666;
// DISPID definitions
const int DISPID_Visible = 1;
const int DISPID_Playing = 2;
const int DISPID_Position = 3;
const int DISPID_Time = 4;
const int DISPID_Length = 5;
const int DISPID_Volume = 6;
const int DISPID_PlayEvent = 1;
const int DISPID_PauseEvent = 2;
const int DISPID_StopEvent = 3;
[
odl,
......@@ -53,13 +65,14 @@ library AXVLC
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.")]
[id(DISPID_Visible), propget, bindable, helpstring("Shows or hides plugin.")]
HRESULT Visible([out, retval] VARIANT_BOOL* visible);
[propput, bindable, helpstring("Shows or hides plugin.")]
[id(DISPID_Visible), propput, bindable, helpstring("Shows or hides plugin.")]
HRESULT Visible([in] VARIANT_BOOL visible);
[helpstring("Play current target in playlist.")]
HRESULT play();
......@@ -67,31 +80,31 @@ library AXVLC
HRESULT pause();
[helpstring("Stop playback.")]
HRESULT stop();
[propget, helpstring("Specifies whether VLC is playing.")]
[id(DISPID_Playing), bindable, propget, helpstring("Specifies whether VLC is playing.")]
HRESULT Playing([out, retval] VARIANT_BOOL* isPlaying);
[propput, helpstring("Specifies whether VLC is playing.")]
[id(DISPID_Playing), bindable, 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.")]
[id(DISPID_Position), bindable, 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.")]
[id(DISPID_Position), bindable, 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.")]
[id(DISPID_Time), bindable, 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.")]
[id(DISPID_Time), bindable, 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.")]
[id(DISPID_Length), bindable, 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%.")]
[id(DISPID_Volume), bindable, 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%.")]
[id(DISPID_Volume), bindable, propput, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]
HRESULT Volume([in] int volume);
[helpstring("Mute/unmute playback sound volume.")]
HRESULT toggleMute();
......@@ -125,11 +138,11 @@ library AXVLC
dispinterface DVLCEvents {
properties:
methods:
[id(1), helpstring("Playback in progress")]
[id(DISPID_PlayEvent), helpstring("Playback in progress")]
void Play();
[id(2), helpstring("Playback has paused")]
[id(DISPID_PauseEvent), helpstring("Playback has paused")]
void Pause();
[id(3), helpstring("Playback has stopped")]
[id(DISPID_StopEvent), helpstring("Playback has stopped")]
void Stop();
};
......
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
axvlc.dll=axvlc.dll
[axvlc.dll]
file-win32-x86=thiscab
clsid={E23FE9C6-778E-49d4-B537-38FCDE4887D8}
FileVersion=0,8,2,0
DestDir=10
RegisterServer=yes
No preview for this file type
/*****************************************************************************
* 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.
*****************************************************************************/
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 5.01.0164 */
/* at Thu Feb 17 09:25:54 2005
*/
/* Compiler settings for axvlc.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
#ifdef __cplusplus
extern "C"{
#endif
......
/*****************************************************************************
* axvlc_idl.h: 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.
*****************************************************************************/
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 5.01.0164 */
/* at Thu Feb 17 09:25:54 2005
*/
/* Compiler settings for axvlc.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
......@@ -83,6 +74,24 @@ enum VLCPlaylistMode
};
#define VLCPlayListEnd ( -666 )
#define DISPID_Visible ( 1 )
#define DISPID_Playing ( 2 )
#define DISPID_Position ( 3 )
#define DISPID_Time ( 4 )
#define DISPID_Length ( 5 )
#define DISPID_Volume ( 6 )
#define DISPID_PlayEvent ( 1 )
#define DISPID_PauseEvent ( 2 )
#define DISPID_StopEvent ( 3 )
EXTERN_C const IID LIBID_AXVLC;
......@@ -107,10 +116,10 @@ EXTERN_C const IID IID_IVLCControl;
virtual /* [helpstring][propput][defaultbind][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Value(
/* [in] */ VARIANT pvarValue) = 0;
virtual /* [helpstring][bindable][propget] */ HRESULT STDMETHODCALLTYPE get_Visible(
virtual /* [helpstring][bindable][propget][id] */ HRESULT STDMETHODCALLTYPE get_Visible(
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *visible) = 0;
virtual /* [helpstring][bindable][propput] */ HRESULT STDMETHODCALLTYPE put_Visible(
virtual /* [helpstring][bindable][propput][id] */ HRESULT STDMETHODCALLTYPE put_Visible(
/* [in] */ VARIANT_BOOL visible) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE play( void) = 0;
......@@ -119,22 +128,22 @@ EXTERN_C const IID IID_IVLCControl;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE stop( void) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Playing(
virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Playing(
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Playing(
virtual /* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Playing(
/* [in] */ VARIANT_BOOL isPlaying) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Position(
virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Position(
/* [retval][out] */ float __RPC_FAR *position) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Position(
virtual /* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Position(
/* [in] */ float position) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Time(
virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Time(
/* [retval][out] */ int __RPC_FAR *seconds) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Time(
virtual /* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Time(
/* [in] */ int seconds) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE shuttle(
......@@ -142,17 +151,17 @@ EXTERN_C const IID IID_IVLCControl;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE fullscreen( void) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Length(
virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Length(
/* [retval][out] */ int __RPC_FAR *seconds) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playFaster( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playSlower( void) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Volume(
virtual /* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Volume(
/* [retval][out] */ int __RPC_FAR *volume) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Volume(
virtual /* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Volume(
/* [in] */ int volume) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE toggleMute( void) = 0;
......@@ -234,11 +243,11 @@ EXTERN_C const IID IID_IVLCControl;
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT pvarValue);
/* [helpstring][bindable][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Visible )(
/* [helpstring][bindable][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Visible )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *visible);
/* [helpstring][bindable][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Visible )(
/* [helpstring][bindable][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Visible )(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT_BOOL visible);
......@@ -251,27 +260,27 @@ EXTERN_C const IID IID_IVLCControl;
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *stop )(
IVLCControl __RPC_FAR * This);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Playing )(
/* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Playing )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Playing )(
/* [helpstring][propput][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Playing )(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT_BOOL isPlaying);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Position )(
/* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Position )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ float __RPC_FAR *position);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Position )(
/* [helpstring][propput][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Position )(
IVLCControl __RPC_FAR * This,
/* [in] */ float position);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Time )(
/* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Time )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Time )(
/* [helpstring][propput][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Time )(
IVLCControl __RPC_FAR * This,
/* [in] */ int seconds);
......@@ -282,7 +291,7 @@ EXTERN_C const IID IID_IVLCControl;
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *fullscreen )(
IVLCControl __RPC_FAR * This);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Length )(
/* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Length )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
......@@ -292,11 +301,11 @@ EXTERN_C const IID IID_IVLCControl;
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *playSlower )(
IVLCControl __RPC_FAR * This);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Volume )(
/* [helpstring][propget][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Volume )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *volume);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Volume )(
/* [helpstring][propput][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Volume )(
IVLCControl __RPC_FAR * This,
/* [in] */ int volume);
......@@ -482,7 +491,7 @@ void __RPC_STUB IVLCControl_put_Value_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][bindable][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Visible_Proxy(
/* [helpstring][bindable][propget][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Visible_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *visible);
......@@ -494,7 +503,7 @@ void __RPC_STUB IVLCControl_get_Visible_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][bindable][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Visible_Proxy(
/* [helpstring][bindable][propput][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Visible_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT_BOOL visible);
......@@ -539,7 +548,7 @@ void __RPC_STUB IVLCControl_stop_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Playing_Proxy(
/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Playing_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying);
......@@ -551,7 +560,7 @@ void __RPC_STUB IVLCControl_get_Playing_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Playing_Proxy(
/* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Playing_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT_BOOL isPlaying);
......@@ -563,7 +572,7 @@ void __RPC_STUB IVLCControl_put_Playing_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Position_Proxy(
/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Position_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ float __RPC_FAR *position);
......@@ -575,7 +584,7 @@ void __RPC_STUB IVLCControl_get_Position_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Position_Proxy(
/* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Position_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ float position);
......@@ -587,7 +596,7 @@ void __RPC_STUB IVLCControl_put_Position_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Time_Proxy(
/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Time_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
......@@ -599,7 +608,7 @@ void __RPC_STUB IVLCControl_get_Time_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Time_Proxy(
/* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Time_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ int seconds);
......@@ -634,7 +643,7 @@ void __RPC_STUB IVLCControl_fullscreen_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Length_Proxy(
/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Length_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
......@@ -668,7 +677,7 @@ void __RPC_STUB IVLCControl_playSlower_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Volume_Proxy(
/* [helpstring][propget][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Volume_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *volume);
......@@ -680,7 +689,7 @@ void __RPC_STUB IVLCControl_get_Volume_Stub(
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Volume_Proxy(
/* [helpstring][propput][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Volume_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ int volume);
......
......@@ -23,9 +23,31 @@
#include "plugin.h"
#include <comcat.h>
#include <windows.h>
#include <shlwapi.h>
using namespace std;
#define COMDLLPATH "axvlc.dll"
#define THREADING_MODEL "Both"
#define COMPANY_STR "VideoLAN"
#define PROGRAM_STR "VLCPlugin"
#define VERSION_MAJOR_STR "1"
#define VERSION_MINOR_STR "0"
#define DESCRIPTION "VideoLAN VLC ActiveX Plugin"
#define PROGID_STR COMPANY_STR"."PROGRAM_STR
#define VERS_PROGID_STR COMPANY_STR"."PROGRAM_STR"."VERSION_MAJOR_STR
#define VERSION_STR VERSION_MAJOR_STR"."VERSION_MINOR_STR
#define GUID_STRLEN 39
/*
** MingW headers do not declare those
*/
extern const CATID CATID_SafeForInitializing;
extern const CATID CATID_SafeForScripting;
static LONG i_class_ref= 0;
static HINSTANCE h_instance= 0;
......@@ -49,13 +71,229 @@ STDAPI DllCanUnloadNow(VOID)
return (0 == i_class_ref) ? S_OK: S_FALSE;
};
STDAPI DllRegisterServer(VOID)
static LPCTSTR TStrFromGUID(REFGUID clsid) {
LPOLESTR oleStr;
if( FAILED(StringFromIID(clsid, &oleStr)) )
return NULL;
//check whether TCHAR and OLECHAR are both either ANSI or UNICODE
if( sizeof(TCHAR) == sizeof(OLECHAR) )
return (LPCTSTR)oleStr;
LPTSTR pct_CLSID = NULL;
#ifndef OLE2ANSI
size_t len = WideCharToMultiByte(CP_ACP, 0, oleStr, -1, NULL, 0, NULL, NULL);
if( len > 0 )
{
pct_CLSID = (char *)CoTaskMemAlloc(len);
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len, NULL, NULL);
}
#else
size_t len = MutiByteToWideChar(CP_ACP, 0, oleStr, -1, NULL, 0);
if( len > 0 )
{
clsidStr = (wchar_t *)CoTaskMemAlloc(len*sizeof(wchar_t));
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len);
}
#endif
CoTaskMemFree(oleStr);
return pct_CLSID;
};
static HKEY keyCreate(HKEY parentKey, LPCTSTR keyName)
{
return S_OK;
HKEY childKey;
if( ERROR_SUCCESS == RegCreateKeyEx(parentKey, keyName, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &childKey, NULL) )
{
return childKey;
}
return NULL;
};
STDAPI DllUnregisterServer(VOID)
{
// unregister type lib from the registry
UnRegisterTypeLib(LIBID_AXVLC, 1, 0, LOCALE_NEUTRAL, SYS_WIN32);
// remove component categories we supports
ICatRegister *pcr;
if( SUCCEEDED(CoCreateInstance(CLSID_StdComponentCategoriesMgr,
NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr)) ) {
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
CATID_SafeForInitializing,
CATID_SafeForScripting,
};
pcr->UnRegisterClassImplCategories(CLSID_VLCPlugin,
sizeof(implCategories)/sizeof(CATID), implCategories);
pcr->Release();
}
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(VERS_PROGID_STR));
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hClsIDKey;
if( ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("CLSID"), 0, KEY_WRITE, &hClsIDKey) )
{
SHDeleteKey(hClsIDKey, psz_CLSID);
RegCloseKey(hClsIDKey);
}
return S_OK;
};
STDAPI DllRegisterServer(VOID)
{
DllUnregisterServer();
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hBaseKey;
if( ERROR_SUCCESS != RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("CLSID"), 0, KEY_CREATE_SUB_KEY, &hBaseKey) )
return E_FAIL;
HKEY hClassKey = keyCreate(hBaseKey, psz_CLSID);
if( NULL != hClassKey )
{
HKEY hSubKey;
// default key value
RegSetValueEx(hClassKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
// Control key value
hSubKey = keyCreate(hClassKey, TEXT("Control"));
RegCloseKey(hSubKey);
// InprocServer32 key value
hSubKey = keyCreate(hClassKey, TEXT("InprocServer32"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)COMDLLPATH, sizeof(COMDLLPATH));
RegSetValueEx(hSubKey, TEXT("ThreadingModel"), 0, REG_SZ,
(const BYTE*)THREADING_MODEL, sizeof(THREADING_MODEL));
RegCloseKey(hSubKey);
// MiscStatus key value
hSubKey = keyCreate(hClassKey, TEXT("MiscStatus\\1"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (const BYTE*)"131473", sizeof("131473"));
RegCloseKey(hSubKey);
// Programmable key value
hSubKey = keyCreate(hClassKey, TEXT("Programmable"));
RegCloseKey(hSubKey);
// ProgID key value
hSubKey = keyCreate(hClassKey, TEXT("ProgID"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERS_PROGID_STR, sizeof(VERS_PROGID_STR));
RegCloseKey(hSubKey);
// VersionIndependentProgID key value
hSubKey = keyCreate(hClassKey, TEXT("VersionIndependentProgID"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)PROGID_STR, sizeof(PROGID_STR));
RegCloseKey(hSubKey);
// Version key value
hSubKey = keyCreate(hClassKey, TEXT("Version"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERSION_STR, sizeof(VERSION_STR));
RegCloseKey(hSubKey);
// TypeLib key value
LPCTSTR psz_LIBID = TStrFromGUID(LIBID_AXVLC);
if( NULL != psz_LIBID )
{
hSubKey = keyCreate(hClassKey, TEXT("TypeLib"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_LIBID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
RegCloseKey(hClassKey);
}
RegCloseKey(hBaseKey);
hBaseKey = keyCreate(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
if( NULL != hBaseKey )
{
// default key value
RegSetValueEx(hBaseKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
HKEY hSubKey = keyCreate(hBaseKey, TEXT("CLSID"));
if( NULL != hSubKey )
{
// default key value