void tLuaCOM::releaseConnections() { if(conn_point==NULL) return; conn_point->Release(); IConnectionPointContainer *pcpc; HRESULT hr = pdisp->QueryInterface(IID_IConnectionPointContainer, (void **) &pcpc); if(FAILED(hr)) { return; } IEnumConnectionPoints *pecp; hr = pcpc->EnumConnectionPoints(&pecp); pcpc->Release(); if(FAILED(hr)) { return; } pecp->Reset(); IConnectionPoint *pcp; ULONG fetched = 0; hr = pecp->Next(1, &pcp, &fetched); while(SUCCEEDED(hr) && fetched) { IEnumConnections *pec; hr = pcp->EnumConnections(&pec); if(SUCCEEDED(hr)) { pec->Reset(); CONNECTDATA conn; ULONG conn_fetched = 0; hr = pec->Next(1, &conn, &conn_fetched); while(SUCCEEDED(hr) && conn_fetched) { pcp->Unadvise(conn.dwCookie); hr = pec->Next(1, &conn, &conn_fetched); } pec->Release(); } pcp->Release(); pecp->Next(1, &pcp, &fetched); } pecp->Release(); }
// @pymethod |PyIEnumConnectionPoints|Reset|Resets the enumeration sequence to the beginning. PyObject *PyIEnumConnectionPoints::Reset(PyObject *self, PyObject *args) { if ( !PyArg_ParseTuple(args, ":Reset") ) return NULL; IEnumConnectionPoints *pIEConnections = GetI(self); if ( pIEConnections == NULL ) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pIEConnections->Reset(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr); Py_INCREF(Py_None); return Py_None; }