mshtml: Added Advise implementation.

This commit is contained in:
Jacek Caban 2006-06-25 15:48:47 +02:00 committed by Alexandre Julliard
parent f46c3997ed
commit bf1724ef33
1 changed files with 42 additions and 2 deletions

View File

@ -40,6 +40,14 @@ struct ConnectionPoint {
const IConnectionPointVtbl *lpConnectionPointVtbl; const IConnectionPointVtbl *lpConnectionPointVtbl;
HTMLDocument *doc; HTMLDocument *doc;
union {
IUnknown *unk;
IDispatch *disp;
IPropertyNotifySink *propnotif;
} *sinks;
DWORD sinks_size;
IID iid; IID iid;
}; };
@ -113,8 +121,38 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
DWORD *pdwCookie) DWORD *pdwCookie)
{ {
ConnectionPoint *This = CONPOINT_THIS(iface); ConnectionPoint *This = CONPOINT_THIS(iface);
FIXME("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie); IUnknown *sink;
return E_NOTIMPL; DWORD i;
HRESULT hres;
TRACE("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
hres = IUnknown_QueryInterface(pUnkSink, &This->iid, (void**)&sink);
if(FAILED(hres) && !IsEqualGUID(&IID_IPropertyNotifySink, &This->iid)) {
hres = IUnknown_QueryInterface(pUnkSink, &IID_IDispatch, (void**)&sink);
if(FAILED(hres))
return CONNECT_E_CANNOTCONNECT;
}
if(This->sinks) {
for(i=0; i<This->sinks_size; i++) {
if(!This->sinks[i].unk)
break;
}
if(i == This->sinks_size)
This->sinks = HeapReAlloc(GetProcessHeap(), 0, This->sinks,
(++This->sinks_size)*sizeof(*This->sinks));
}else {
This->sinks = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->sinks));
This->sinks_size = 1;
i = 0;
}
This->sinks[i].unk = sink;
*pdwCookie = i+1;
return S_OK;
} }
static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie) static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
@ -152,6 +190,8 @@ static void ConnectionPoint_Create(HTMLDocument *doc, REFIID riid, ConnectionPoi
ret->lpConnectionPointVtbl = &ConnectionPointVtbl; ret->lpConnectionPointVtbl = &ConnectionPointVtbl;
ret->doc = doc; ret->doc = doc;
ret->sinks = NULL;
ret->sinks_size = 0;
memcpy(&ret->iid, riid, sizeof(IID)); memcpy(&ret->iid, riid, sizeof(IID));
*cp = ret; *cp = ret;