Commit f533f3d8 authored by Damien Fouilleul's avatar Damien Fouilleul

ActiveX: misc fixes & improvements

parent bd59418e
...@@ -126,11 +126,11 @@ library AXVLC ...@@ -126,11 +126,11 @@ library AXVLC
properties: properties:
methods: methods:
[id(1), helpstring("Playback in progress")] [id(1), helpstring("Playback in progress")]
void OnPlay(); void Play();
[id(2), helpstring("Playback has paused")] [id(2), helpstring("Playback has paused")]
void OnPause(); void Pause();
[id(3), helpstring("Playback has stopped")] [id(3), helpstring("Playback has stopped")]
void OnStop(); void Stop();
}; };
[ [
......
No preview for this file type
...@@ -133,7 +133,7 @@ STDMETHODIMP VLCConnectionPoint::EnumConnections(IEnumConnections **ppEnum) ...@@ -133,7 +133,7 @@ STDMETHODIMP VLCConnectionPoint::EnumConnections(IEnumConnections **ppEnum)
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY; return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
}; };
void VLCConnectionPoint::fireEvent(DISPID dispId, LCID lcid, DISPPARAMS* pDispParams) void VLCConnectionPoint::fireEvent(DISPID dispId, DISPPARAMS* pDispParams)
{ {
vector<CONNECTDATA>::iterator end = _connections.end(); vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin(); vector<CONNECTDATA>::iterator iter = _connections.begin();
...@@ -146,13 +146,7 @@ void VLCConnectionPoint::fireEvent(DISPID dispId, LCID lcid, DISPPARAMS* pDispPa ...@@ -146,13 +146,7 @@ void VLCConnectionPoint::fireEvent(DISPID dispId, LCID lcid, DISPPARAMS* pDispPa
IDispatch *pDisp; IDispatch *pDisp;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) ) if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
{ {
unsigned int puArgErr; pDisp->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, pDispParams, NULL, NULL, NULL);
VARIANT vRes;
if( SUCCEEDED(pDisp->Invoke(dispId, IID_NULL, lcid, DISPATCH_METHOD, pDispParams, &vRes, NULL, &puArgErr)) )
{
VariantClear(&vRes);
}
pDisp->Release(); pDisp->Release();
} }
} }
...@@ -281,9 +275,9 @@ STDMETHODIMP VLCConnectionPointContainer::FindConnectionPoint(REFIID riid, IConn ...@@ -281,9 +275,9 @@ STDMETHODIMP VLCConnectionPointContainer::FindConnectionPoint(REFIID riid, IConn
return NOERROR; return NOERROR;
}; };
void VLCConnectionPointContainer::fireEvent(DISPID dispId, LCID lcid, DISPPARAMS* pDispParams) void VLCConnectionPointContainer::fireEvent(DISPID dispId, DISPPARAMS* pDispParams)
{ {
_p_events->fireEvent(dispId,lcid, pDispParams); _p_events->fireEvent(dispId, pDispParams);
}; };
void VLCConnectionPointContainer::firePropChangedEvent(DISPID dispId) void VLCConnectionPointContainer::firePropChangedEvent(DISPID dispId)
......
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
STDMETHODIMP Unadvise(DWORD); STDMETHODIMP Unadvise(DWORD);
STDMETHODIMP EnumConnections(LPENUMCONNECTIONS *); STDMETHODIMP EnumConnections(LPENUMCONNECTIONS *);
void fireEvent(DISPID dispIdMember, LCID lcid, DISPPARAMS* pDispParams); void fireEvent(DISPID dispIdMember, DISPPARAMS* pDispParams);
void firePropChangedEvent(DISPID dispId); void firePropChangedEvent(DISPID dispId);
private: private:
...@@ -101,7 +101,7 @@ public: ...@@ -101,7 +101,7 @@ public:
STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *); STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *);
STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *); STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *);
void fireEvent(DISPID, LCID, DISPPARAMS*); void fireEvent(DISPID, DISPPARAMS*);
void firePropChangedEvent(DISPID dispId); void firePropChangedEvent(DISPID dispId);
private: private:
......
...@@ -743,7 +743,7 @@ void VLCPlugin::fireOnPlayEvent(void) ...@@ -743,7 +743,7 @@ 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, LOCALE_USER_DEFAULT, &dispparamsNoArgs); vlcConnectionPointContainer->fireEvent(1, &dispparamsNoArgs);
} }
}; };
...@@ -752,7 +752,7 @@ void VLCPlugin::fireOnPauseEvent(void) ...@@ -752,7 +752,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, LOCALE_USER_DEFAULT, &dispparamsNoArgs); vlcConnectionPointContainer->fireEvent(2, &dispparamsNoArgs);
} }
}; };
...@@ -761,7 +761,7 @@ void VLCPlugin::fireOnStopEvent(void) ...@@ -761,7 +761,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, LOCALE_USER_DEFAULT, &dispparamsNoArgs); vlcConnectionPointContainer->fireEvent(3, &dispparamsNoArgs);
} }
}; };
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
/* custom methods */ /* custom methods */
HRESULT getTypeLib(ITypeLib **pTL) HRESULT getTypeLib(ITypeLib **pTL)
{ return LoadRegTypeLib(LIBID_AXVLC, 1, 0, LOCALE_NEUTRAL, pTL); }; { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, LOCALE_USER_DEFAULT, 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; };
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
int getVLCObject(void) { return _i_vlc; }; int getVLCObject(void) { return _i_vlc; };
// initial properties // control properties
void setSourceURL(const char *url) { _psz_src = strdup(url); }; void setSourceURL(const char *url) { _psz_src = strdup(url); };
void setAutoStart(BOOL autostart) { _b_autostart = autostart; }; void setAutoStart(BOOL autostart) { _b_autostart = autostart; };
void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; }; void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };
...@@ -114,12 +114,14 @@ public: ...@@ -114,12 +114,14 @@ public:
} }
}; };
void setShowDisplay(BOOL show) { _b_showdisplay = show; }; void setShowDisplay(BOOL show) { _b_showdisplay = show; };
BOOL getShowDisplay(void) { return _b_showdisplay; };
void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };
// 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);
// plugin events // control events
void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };
void fireOnPlayEvent(void); void fireOnPlayEvent(void);
void fireOnPauseEvent(void); void fireOnPauseEvent(void);
void fireOnStopEvent(void); void fireOnStopEvent(void);
......
...@@ -35,7 +35,7 @@ STDMETHODIMP VLCProvideClassInfo::GetClassInfo(ITypeInfo **ppTI) ...@@ -35,7 +35,7 @@ STDMETHODIMP VLCProvideClassInfo::GetClassInfo(ITypeInfo **ppTI)
HRESULT hr = _p_instance->getTypeLib(&p_typelib); HRESULT hr = _p_instance->getTypeLib(&p_typelib);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
hr = p_typelib->GetTypeInfoOfGuid(_p_instance->getDispEventID(), ppTI); hr = p_typelib->GetTypeInfoOfGuid(_p_instance->getClassID(), ppTI);
if( FAILED(hr) ) if( FAILED(hr) )
{ {
*ppTI = NULL; *ppTI = NULL;
......
...@@ -26,31 +26,31 @@ MRL: ...@@ -26,31 +26,31 @@ MRL:
</OBJECT> </OBJECT>
<SCRIPT LANGUAGE="JScript"> <SCRIPT LANGUAGE="JScript">
<!-- <!--
function vlc::OnPlay() function vlc::play()
{ {
alert("Playing"); alert("VLC is Playing");
}; };
function vlc::OnPause() function vlc::pause()
{ {
alert("Paused"); alert("VLC has Paused");
}; };
function vlc::OnStop() function vlc::stop()
{ {
alert("Stopped"); alert("VLC has Stopped");
}; };
//--> //-->
</SCRIPT> </SCRIPT>
</TD></TR> </TD></TR>
<TR><TD> <TR><TD>
<INPUT type=submit value="Play" onClick='document.vlc.play();'> <INPUT type=button value="Play" onClick='document.vlc.play();'>
<INPUT type=submit value="Pause" onClick='document.vlc.pause();'> <INPUT type=button value="Stop" onClick='document.vlc.stop();'>
<INPUT type=submit value="Stop" onClick='document.vlc.stop();'> <INPUT type=button value="Pause" onClick='document.vlc.pause();'>
<INPUT type=submit value=" << " onClick='document.vlc.playSlower();'> <INPUT type=button value=" << " onClick='document.vlc.playSlower();'>
<INPUT type=submit value=" >> " onClick='document.vlc.playFaster();'> <INPUT type=button value=" >> " onClick='document.vlc.playFaster();'>
<INPUT type=submit value="Mute" onClick='document.vlc.toggleMute();'> <INPUT type=button value="Mute" onClick='document.vlc.toggleMute();'>
<INPUT type=submit value="Show" onClick='document.vlc.Visible = true;'> <INPUT type=button value="Show" onClick='document.vlc.Visible = true;'>
<INPUT type=submit value="Hide" onClick='document.vlc.Visible = false;'> <INPUT type=button value="Hide" onClick='document.vlc.Visible = false;'>
<INPUT type=submit value="Version" onClick='alert(document.vlc.VersionInfo);'> <INPUT type=button value="Version" onClick='alert(document.vlc.VersionInfo);'>
</TD></TR> </TD></TR>
</TABLE> </TABLE>
</BODY> </BODY>
......
...@@ -39,7 +39,7 @@ char *CStrFromBSTR(int codePage, BSTR bstr) ...@@ -39,7 +39,7 @@ char *CStrFromBSTR(int codePage, BSTR bstr)
{ {
char *buffer = (char *)malloc(mblen+1); char *buffer = (char *)malloc(mblen+1);
ZeroMemory(buffer, mblen+1); ZeroMemory(buffer, mblen+1);
if( WideCharToMultiByte(CP_ACP, 0, bstr, len, buffer, mblen, NULL, NULL) ) if( WideCharToMultiByte(codePage, 0, bstr, len, buffer, mblen, NULL, NULL) )
return buffer; return buffer;
} }
} }
......
...@@ -132,7 +132,7 @@ STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible) ...@@ -132,7 +132,7 @@ STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible)
if( _p_instance->isInPlaceActive() ) if( _p_instance->isInPlaceActive() )
*isVisible = _p_instance->isVisible() ? VARIANT_TRUE : VARIANT_FALSE; *isVisible = _p_instance->isVisible() ? VARIANT_TRUE : VARIANT_FALSE;
else else
*isVisible = VARIANT_FALSE; *isVisible = _p_instance->getShowDisplay() ? VARIANT_TRUE : VARIANT_FALSE;
return NOERROR; return NOERROR;
}; };
......
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