class cArcGISVersionEvents : public IVersionEvents ... implements interface IVersionEvents + QueryInterface method which gets called (2x - first call from our code, second from COM object
HRESULT RegisterVersionEvents(IVersionedWorkspace* _workspace, cArcGISVersionEvents* _eventHandler) { HRESULT hr = E_FAIL; DWORD cookie = 0; CComPtr<IConnectionPointContainer> cpc; _workspace->QueryInterface(IID_IConnectionPointContainer,(void**)&cpc); if (cpc) { CComPtr<IConnectionPoint> cp; hr = cpc->FindConnectionPoint(IID_IVersionEvents, &cp); if (cp) { IUnknown* pUnk = NULL; _eventHandler->QueryInterface(IID_IVersionEvents,(void**)&pUnk); hr = cp->Advise(pUnk, &cookie); } } return hr; }
static IVersionEvents_Event m_VersionEvents; static void SetUpEvent() { IVersion version = m_featureWorkspace as IVersion; m_VersionEvents = version as IVersionEvents_Event; m_VersionEvents.OnRefreshVersion += new IVersionEvents_OnRefreshVersionEventHandler(m_VersionEvents_OnRefreshVersion); } static void m_VersionEvents_OnRefreshVersion() { int x = 1; }
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.