codeconverter

ApplicationStatusEvents throws COM exception

Discussion created by codeconverter on Jan 6, 2011
Latest reply on Jan 6, 2011 by agray1
I have some code that worked in VB6 (Arc 9.3) but is now throwing a COM error in VB.NET (Arc 10).
The code  declares at the top:

Private WithEvents pApplicationStatusEvents As ESRI.ArcGIS.Framework.ApplicationStatusEvents

Then later we have:

    Private Sub IExtension_Startup(ByRef initializationData As Object) _
    Implements ESRI.ArcGIS.esriSystem.IExtension.Startup
        Try
            If (TypeOf initializationData Is ESRI.ArcGIS.Framework.IApplication) Then
                m_pApp = initializationData
                pApplicationStatusEvents = m_pApp
            End If
...

When it executes the pApplicationStatusEvents = m_pApp line, I get the following error:

Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Framework.ApplicationStatusEvents'.  This operation failed because the QueryInterface call on the COM component for the interface with IID '{...}' failed due to the following error: No such interface supported (Exception fro mHRESULT: 0x80004002 (E_NOINTERFACE)).

Does anyone know if this capability has gone away?  I think what it was supposed to do in call the Initialize method when the applications gui was fully initialized but I could be wrong.  I inherited this code and I'm not sure of all of its quirks.

Outcomes