Commit 6d094baf authored by Damien Fouilleul's avatar Damien Fouilleul

- miscelleanous fixes and improvements

- self registration (Internet installation now possible)
parent 0c84bbed
...@@ -96,7 +96,7 @@ endif ...@@ -96,7 +96,7 @@ endif
DATA_axvlc_rc = $(noinst_axvlc_rc_DATA) DATA_axvlc_rc = $(noinst_axvlc_rc_DATA)
noinst_axvlc_rc_DATA = axvlc_rc.$(OBJEXT) noinst_axvlc_rc_DATA = axvlc_rc.$(OBJEXT)
noinst_axvlc_rcdir = $(libdir) 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 $@ $(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 else
......
...@@ -3,13 +3,16 @@ ...@@ -3,13 +3,16 @@
The VLC ActiveX Control has been primary designed to work with Internet Explorer. The VLC ActiveX Control has been primary designed to work with Internet Explorer.
however it may also work with Visual Basic and/or .NET 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 Please note, that this code does not rely upon MFC/ATL, hence good compatibility
is not guaranteed is not guaranteed.
== Compiling == == 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. 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. repository so that you will only need the MIDL compiler if you change axvlc.idl.
the generated files are as follow: the generated files are as follow:
...@@ -28,18 +31,36 @@ export MIDL="midl" ...@@ -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 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. 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 distributed and it may be installed anywhere on the target machine as long as
its path is correct within the registry. its path is specified within your PATH environment variable. Typically, you would
the necessary registry settings are stored in axvlc.reg install it into your WINDOWS directory.
in order to use the plugin, you will need to VLC properly installed on your system if the control needs other VLC plugins, you will need to have VLC installed
otherwise make sure that the plugin path is set in the registry as indicated below on your system, otherwise make sure that the plugin path is set in the registry
as indicated below
[HKEY_LOCAL_MACHINE\Software\VideoLAN\VLC] [HKEY_LOCAL_MACHINE\Software\VideoLAN\VLC]
InstallDir="path\\dir\\" 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, regards,
Damien Fouilleul <Damien dot Fouilleul at laposte dot net> Damien Fouilleul <Damien dot Fouilleul at laposte dot net>
...@@ -44,6 +44,18 @@ library AXVLC ...@@ -44,6 +44,18 @@ library AXVLC
// playlist target position // 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, odl,
uuid(C2FA41D0-B113-476e-AC8C-9BD14999C1C1), uuid(C2FA41D0-B113-476e-AC8C-9BD14999C1C1),
...@@ -53,13 +65,14 @@ library AXVLC ...@@ -53,13 +65,14 @@ library AXVLC
oleautomation oleautomation
] ]
interface IVLCControl : IDispatch { interface IVLCControl : IDispatch {
[id(0), bindable, defaultbind, propget, helpstring("Specifies current target in playlist")] [id(0), bindable, defaultbind, propget, helpstring("Specifies current target in playlist")]
HRESULT Value([out, retval] VARIANT* pvarValue); HRESULT Value([out, retval] VARIANT* pvarValue);
[id(0), bindable, defaultbind, propput, helpstring("Specifies current target in playlist")] [id(0), bindable, defaultbind, propput, helpstring("Specifies current target in playlist")]
HRESULT Value([in] VARIANT pvarValue); 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); 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); HRESULT Visible([in] VARIANT_BOOL visible);
[helpstring("Play current target in playlist.")] [helpstring("Play current target in playlist.")]
HRESULT play(); HRESULT play();
...@@ -67,31 +80,31 @@ library AXVLC ...@@ -67,31 +80,31 @@ library AXVLC
HRESULT pause(); HRESULT pause();
[helpstring("Stop playback.")] [helpstring("Stop playback.")]
HRESULT stop(); 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); 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); 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); 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); 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); 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); HRESULT Time([in] int seconds);
[helpstring("Advance or backtrack playback time, relative to current time.")] [helpstring("Advance or backtrack playback time, relative to current time.")]
HRESULT shuttle([in] int seconds); HRESULT shuttle([in] int seconds);
[helpstring("Switch between normal and fullscreen video.")] [helpstring("Switch between normal and fullscreen video.")]
HRESULT fullscreen(); 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); HRESULT Length([out, retval] int* seconds);
[helpstring("Increases playback speed, one of 1x, 2x, 4x, 8x.")] [helpstring("Increases playback speed, one of 1x, 2x, 4x, 8x.")]
HRESULT playFaster(); HRESULT playFaster();
[helpstring("Decreases playback speed, one of 1x, 2x, 4x, 8x.")] [helpstring("Decreases playback speed, one of 1x, 2x, 4x, 8x.")]
HRESULT playSlower(); 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); 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); HRESULT Volume([in] int volume);
[helpstring("Mute/unmute playback sound volume.")] [helpstring("Mute/unmute playback sound volume.")]
HRESULT toggleMute(); HRESULT toggleMute();
...@@ -125,11 +138,11 @@ library AXVLC ...@@ -125,11 +138,11 @@ library AXVLC
dispinterface DVLCEvents { dispinterface DVLCEvents {
properties: properties:
methods: methods:
[id(1), helpstring("Playback in progress")] [id(DISPID_PlayEvent), helpstring("Playback in progress")]
void Play(); void Play();
[id(2), helpstring("Playback has paused")] [id(DISPID_PauseEvent), helpstring("Playback has paused")]
void Pause(); void Pause();
[id(3), helpstring("Playback has stopped")] [id(DISPID_StopEvent), helpstring("Playback has stopped")]
void Stop(); 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
/***************************************************************************** /* this file contains the actual definitions of */
* axvlc_idl.c: ActiveX control for VLC /* the IIDs and CLSIDs */
*****************************************************************************
* 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.
*****************************************************************************/
/* 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 #ifdef __cplusplus
extern "C"{ extern "C"{
#endif #endif
......
This diff is collapsed.
...@@ -23,9 +23,31 @@ ...@@ -23,9 +23,31 @@
#include "plugin.h" #include "plugin.h"
#include <comcat.h> #include <comcat.h>
#include <windows.h>
#include <shlwapi.h>
using namespace std; 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 LONG i_class_ref= 0;
static HINSTANCE h_instance= 0; static HINSTANCE h_instance= 0;
...@@ -49,13 +71,229 @@ STDAPI DllCanUnloadNow(VOID) ...@@ -49,13 +71,229 @@ STDAPI DllCanUnloadNow(VOID)
return (0 == i_class_ref) ? S_OK: S_FALSE; 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) 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
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_CLSID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
hSubKey = keyCreate(hBaseKey, TEXT("CurVer"));
if( NULL != hSubKey )
{
// default key value
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERS_PROGID_STR, sizeof(VERS_PROGID_STR));
RegCloseKey(hSubKey);
}
RegCloseKey(hBaseKey);
}
hBaseKey = keyCreate(HKEY_CLASSES_ROOT, TEXT(VERS_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
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_CLSID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
}
RegCloseKey(hBaseKey);
}
// indicate which component categories we support
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->RegisterClassImplCategories(CLSID_VLCPlugin,
sizeof(implCategories)/sizeof(CATID), implCategories);
pcr->Release();
}
// register type lib into the registry
ITypeLib *typeLib;
if( SUCCEEDED(LoadTypeLibEx(OLESTR("")COMDLLPATH, REGKIND_REGISTER, &typeLib)) )
typeLib->Release();
return S_OK; return S_OK;
}; };
...@@ -64,8 +302,7 @@ STDAPI DllUnregisterServer(VOID) ...@@ -64,8 +302,7 @@ STDAPI DllUnregisterServer(VOID)
/* /*
** easier to debug an application than a DLL on cygwin GDB :) ** easier to debug an application than a DLL on cygwin GDB :)
*/ */
#include <stream.h>
#include <iostream>
STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{ {
......
...@@ -233,11 +233,19 @@ STDMETHODIMP VLCOleObject::GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus) ...@@ -233,11 +233,19 @@ STDMETHODIMP VLCOleObject::GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus)
if( NULL != pdwStatus ) if( NULL != pdwStatus )
return E_POINTER; return E_POINTER;
switch( dwAspect )
{
case DVASPECT_CONTENT:
*pdwStatus = OLEMISC_RECOMPOSEONRESIZE *pdwStatus = OLEMISC_RECOMPOSEONRESIZE
| OLEMISC_CANTLINKINSIDE | OLEMISC_CANTLINKINSIDE
| OLEMISC_INSIDEOUT | OLEMISC_INSIDEOUT
| OLEMISC_ACTIVATEWHENVISIBLE | OLEMISC_ACTIVATEWHENVISIBLE
| OLEMISC_SETCLIENTSITEFIRST; | OLEMISC_SETCLIENTSITEFIRST;
break;
default:
*pdwStatus = 0;
}
return S_OK; return S_OK;
}; };
......
...@@ -108,7 +108,7 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr ...@@ -108,7 +108,7 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
V_VT(&value) = VT_BOOL; V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("showdisplay"), &value, pErrorLog) ) if( S_OK == pPropBag->Read(OLESTR("showdisplay"), &value, pErrorLog) )
{ {
_p_instance->setShowDisplay(V_BOOL(&value) != VARIANT_FALSE); _p_instance->setVisible(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value); VariantClear(&value);
} }
......
...@@ -229,7 +229,7 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class) : ...@@ -229,7 +229,7 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class) :
_psz_src(NULL), _psz_src(NULL),
_b_autostart(TRUE), _b_autostart(TRUE),
_b_loopmode(FALSE), _b_loopmode(FALSE),
_b_showdisplay(TRUE), _b_visible(TRUE),
_b_sendevents(TRUE), _b_sendevents(TRUE),
_i_vlc(0) _i_vlc(0)
{ {
...@@ -590,13 +590,14 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc ...@@ -590,13 +590,14 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
SetWindowLongPtr(_videownd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); SetWindowLongPtr(_videownd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
if( getVisible() )
ShowWindow(_inplacewnd, SW_SHOWNORMAL);
/* horrible cast there */ /* horrible cast there */
vlc_value_t val; vlc_value_t val;
val.i_int = reinterpret_cast<int>(_videownd); val.i_int = reinterpret_cast<int>(_videownd);
VLC_VariableSet(_i_vlc, "drawable", val); VLC_VariableSet(_i_vlc, "drawable", val);
setVisible(_b_showdisplay);
if( NULL != _psz_src ) if( NULL != _psz_src )
{ {
// add target to playlist // add target to playlist
...@@ -631,14 +632,12 @@ HRESULT VLCPlugin::onInPlaceDeactivate(void) ...@@ -631,14 +632,12 @@ HRESULT VLCPlugin::onInPlaceDeactivate(void)
return S_OK; return S_OK;
}; };
BOOL VLCPlugin::isVisible(void)
{
return GetWindowLong(_inplacewnd, GWL_STYLE) & WS_VISIBLE;
};
void VLCPlugin::setVisible(BOOL fVisible) void VLCPlugin::setVisible(BOOL fVisible)
{ {
ShowWindow(_inplacewnd, fVisible ? SW_SHOW : SW_HIDE); _b_visible = fVisible;
if( isInPlaceActive() )
ShowWindow(_inplacewnd, fVisible ? SW_SHOWNORMAL : SW_HIDE);
firePropChangedEvent(DISPID_Visible);
}; };
void VLCPlugin::setFocus(BOOL fFocus) void VLCPlugin::setFocus(BOOL fFocus)
...@@ -738,12 +737,20 @@ void VLCPlugin::onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect) ...@@ -738,12 +737,20 @@ void VLCPlugin::onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
UpdateWindow(_videownd); UpdateWindow(_videownd);
}; };
void VLCPlugin::firePropChangedEvent(DISPID dispid)
{
if( _b_sendevents )
{
vlcConnectionPointContainer->firePropChangedEvent(dispid);
}
};
void VLCPlugin::fireOnPlayEvent(void) void VLCPlugin::fireOnPlayEvent(void)
{ {
if( _b_sendevents ) if( _b_sendevents )
{ {
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
vlcConnectionPointContainer->fireEvent(1, &dispparamsNoArgs); vlcConnectionPointContainer->fireEvent(DISPID_PlayEvent, &dispparamsNoArgs);
} }
}; };
...@@ -752,7 +759,7 @@ void VLCPlugin::fireOnPauseEvent(void) ...@@ -752,7 +759,7 @@ void VLCPlugin::fireOnPauseEvent(void)
if( _b_sendevents ) if( _b_sendevents )
{ {
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
vlcConnectionPointContainer->fireEvent(2, &dispparamsNoArgs); vlcConnectionPointContainer->fireEvent(DISPID_PauseEvent, &dispparamsNoArgs);
} }
}; };
...@@ -761,7 +768,7 @@ void VLCPlugin::fireOnStopEvent(void) ...@@ -761,7 +768,7 @@ void VLCPlugin::fireOnStopEvent(void)
if( _b_sendevents ) if( _b_sendevents )
{ {
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
vlcConnectionPointContainer->fireEvent(3, &dispparamsNoArgs); vlcConnectionPointContainer->fireEvent(DISPID_StopEvent, &dispparamsNoArgs);
} }
}; };
...@@ -79,8 +79,8 @@ public: ...@@ -79,8 +79,8 @@ public:
STDMETHODIMP_(ULONG) Release(void); STDMETHODIMP_(ULONG) Release(void);
/* custom methods */ /* custom methods */
HRESULT getTypeLib(ITypeLib **pTL) HRESULT getTypeLib(LCID lcid, ITypeLib **pTL)
{ return LoadRegTypeLib(LIBID_AXVLC, 1, 0, LOCALE_USER_DEFAULT, pTL); }; { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; }; REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; }; REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
...@@ -92,9 +92,6 @@ public: ...@@ -92,9 +92,6 @@ public:
HRESULT onInPlaceDeactivate(void); HRESULT onInPlaceDeactivate(void);
HWND getInPlaceWindow(void) const { return _inplacewnd; }; HWND getInPlaceWindow(void) const { return _inplacewnd; };
BOOL isVisible(void);
void setVisible(BOOL fVisible);
BOOL hasFocus(void); BOOL hasFocus(void);
void setFocus(BOOL fFocus); void setFocus(BOOL fFocus);
...@@ -113,15 +110,16 @@ public: ...@@ -113,15 +110,16 @@ public:
VLC_VolumeMute(_i_vlc); VLC_VolumeMute(_i_vlc);
} }
}; };
void setShowDisplay(BOOL show) { _b_showdisplay = show; };
BOOL getShowDisplay(void) { return _b_showdisplay; };
void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; }; void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };
void setVisible(BOOL fVisible);
BOOL getVisible(void) { return _b_visible; };
// container events // container events
void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect); void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
void onPaint(PAINTSTRUCT &ps, RECT &pr); void onPaint(PAINTSTRUCT &ps, RECT &pr);
// control events // control events
void firePropChangedEvent(DISPID dispid);
void fireOnPlayEvent(void); void fireOnPlayEvent(void);
void fireOnPauseEvent(void); void fireOnPauseEvent(void);
void fireOnStopEvent(void); void fireOnStopEvent(void);
...@@ -160,7 +158,7 @@ private: ...@@ -160,7 +158,7 @@ private:
char *_psz_src; char *_psz_src;
BOOL _b_autostart; BOOL _b_autostart;
BOOL _b_loopmode; BOOL _b_loopmode;
BOOL _b_showdisplay; BOOL _b_visible;
BOOL _b_sendevents; BOOL _b_sendevents;
int _i_vlc; int _i_vlc;
}; };
......
...@@ -32,7 +32,7 @@ STDMETHODIMP VLCProvideClassInfo::GetClassInfo(ITypeInfo **ppTI) ...@@ -32,7 +32,7 @@ STDMETHODIMP VLCProvideClassInfo::GetClassInfo(ITypeInfo **ppTI)
if( NULL == ppTI ) if( NULL == ppTI )
return E_POINTER; return E_POINTER;
HRESULT hr = _p_instance->getTypeLib(&p_typelib); HRESULT hr = _p_instance->getTypeLib(LOCALE_NEUTRAL, &p_typelib);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
hr = p_typelib->GetTypeInfoOfGuid(_p_instance->getClassID(), ppTI); hr = p_typelib->GetTypeInfoOfGuid(_p_instance->getClassID(), ppTI);
......
...@@ -17,7 +17,7 @@ MRL: ...@@ -17,7 +17,7 @@ MRL:
<INPUT type=submit value="Go" onClick="go(targetTextField.value);"> <INPUT type=submit value="Go" onClick="go(targetTextField.value);">
</TD></TR> </TD></TR>
<TR><TD> <TR><TD>
<OBJECT classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8" <OBJECT classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8" codebase="axvlc.cab"
width="640" height="480" id="vlc" events="True"> width="640" height="480" id="vlc" events="True">
<param name="Src" value="" /> <param name="Src" value="" />
<param name="ShowDisplay" value="True" /> <param name="ShowDisplay" value="True" />
......
...@@ -38,7 +38,7 @@ HRESULT VLCControl::getTypeInfo(void) ...@@ -38,7 +38,7 @@ HRESULT VLCControl::getTypeInfo(void)
{ {
ITypeLib *p_typelib; ITypeLib *p_typelib;
HRESULT hr = _p_instance->getTypeLib(&p_typelib); HRESULT hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCControl, &_p_typeinfo); hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCControl, &_p_typeinfo);
...@@ -129,20 +129,14 @@ STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible) ...@@ -129,20 +129,14 @@ STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible)
if( NULL == isVisible ) if( NULL == isVisible )
return E_INVALIDARG; return E_INVALIDARG;
if( _p_instance->isInPlaceActive() ) *isVisible = _p_instance->getVisible();
*isVisible = _p_instance->isVisible() ? VARIANT_TRUE : VARIANT_FALSE;
else
*isVisible = _p_instance->getShowDisplay() ? VARIANT_TRUE : VARIANT_FALSE;
return NOERROR; return NOERROR;
}; };
STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible) STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
{ {
if( _p_instance->isInPlaceActive() )
_p_instance->setVisible(isVisible != VARIANT_FALSE); _p_instance->setVisible(isVisible != VARIANT_FALSE);
else
_p_instance->setShowDisplay(isVisible != VARIANT_FALSE);
return NOERROR; return NOERROR;
}; };
......
...@@ -4040,10 +4040,10 @@ if test "${enable_activex}" != "no" ...@@ -4040,10 +4040,10 @@ if test "${enable_activex}" != "no"
then then
if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin" if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
then then
AC_CHECK_PROG(MIDL, midl, :) AC_CHECK_PROGS(MIDL, [midl widl], no)
AC_CHECK_HEADERS(ole2.h olectl.h, AC_CHECK_HEADERS(ole2.h olectl.h,
[ VLC_ADD_CXXFLAGS([activex],[-fno-exceptions]) [ VLC_ADD_CXXFLAGS([activex],[-fno-exceptions])
VLC_ADD_LDFLAGS([activex],[-lole32 -loleaut32 -luuid]) VLC_ADD_LDFLAGS([activex],[-lole32 -loleaut32 -luuid -lshlwapi])
AC_CHECK_HEADERS(objsafe.h, AC_CHECK_HEADERS(objsafe.h,
VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER]) VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER])
) )
...@@ -4054,7 +4054,7 @@ then ...@@ -4054,7 +4054,7 @@ then
fi fi
fi fi
AC_ARG_VAR(MIDL, [Microsoft IDL compiler (Win32 platform only)]) AC_ARG_VAR(MIDL, [Microsoft IDL compiler (Win32 platform only)])
AM_CONDITIONAL(HAS_MIDL_COMPILER, test -n "${MIDL}") AM_CONDITIONAL(HAS_MIDL_COMPILER, test "${MIDL}" != "no")
AM_CONDITIONAL(BUILD_ACTIVEX,${activex}) AM_CONDITIONAL(BUILD_ACTIVEX,${activex})
dnl dnl
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment