IVersionEvents - not firing

1061
3
02-27-2013 07:04 PM
AdhimoolamD
New Contributor
Hi,

We have a senario to catch the VersionChange event in ArcMap, to achieve this we try to implement the  IVersionEvents
, IWorkspaceExtension2 and IWorkspaceExtensionControl interface and registered with GeodatabaseWorkspaceExtensions component category.

Even tried with  a propritery class to Listen the events (IVersionEvents_Event)

No success, Kindly help us to catch the IVersionEvents in ArcMap.

Thanks & Regards,
Adhi.D
0 Kudos
3 Replies
RichardWatson
Frequent Contributor
What version of ArcMap are you using?

If it is 10.0 or later, are you calling ESRIRegAsm such that the component category is registered?

It might be helpful if you posted the code that you wrote and describe how you installed/registered it.
0 Kudos
TomasBartonek
New Contributor
Hi,

we have the same problem - events not firing. Did you find a solution?
We use Argis 10.1, GeoDB (Oracle) C++ and direct COM interfaces.. All code compiles fine and runs - just events are not comming when doing e.g. reconcilation.. (Please note: we don't like to implement extension interfaces - although we tried it did not help)

Code snippet:

class cArcGISVersionEvents : public IVersionEvents
... implements interface IVersionEvents + QueryInterface method which gets called (2x - first call from our code, second from COM object


Then we have function to register events - it takes workspace and our handler.. When debugging it gets through the code correctly, no exception, no error..

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;
}



Thanks Tomas
0 Kudos
TimSexton1
Occasional Contributor
Having the same issues with IVersionEvents not firing in 10.1 or 10.2.  With the sample code below, m_VersionEvents_OnRefreshVersion() never gets called when the Refresh Version button is clicked on the Versioning toolbar.

        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;
        }


Any ideas?
0 Kudos