DockableWindow Depolyment Problem

1173
8
Jump to solution
03-12-2012 11:27 AM
BillMacPherson
New Contributor III
I'm having a problem deploying my project with a DockableWindow. On the target machine the dockable window Id returns NULL. All works fine on the development machine.

I think it is a registration problem on the target machine but, I'm not clear how or why I to register the DockableWindow. If it is a registration issue, please tell me how to register this window.

Code from the form that implements the dockable window
#Region "COM GUIDs"     ' These  GUIDs provide the COM identity for this class      ' and its COM interfaces. If you change them, existing      ' clients will no longer be able to access the class.     Public Const ClassId As String = "8582b32d-120c-407b-af34-8719b8960b30"     Public Const InterfaceId As String = "fec13c95-bd53-44cd-b8ef-f7d83f33fbb2"     Public Const EventsId As String = "1e9d36cc-df74-40c4-a8a7-461a0f75b13d" #End Region


Code from class module that creates a tool button which displays a form containing the DockableWindow.
            If m_dockableWindow Is Nothing Then                 Dim dockWindowManager As IDockableWindowManager                 dockWindowManager = CType(m_pApp, IDockableWindowManager)                 If Not dockWindowManager Is Nothing Then                     Dim windowID As UID = New UIDClass                     windowID.Value = "{8582b32d-120c-407b-af34-8719b8960b30}"                     m_dockableWindow = dockWindowManager.GetDockableWindow(windowID)                 End If             End If


I have added the following to the project file.
   <Target Name="BeforeClean">     <Exec WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin" Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /u /s" Condition="Exists('$(TargetPath)')" />   </Target>   <Target Name="AfterBuild">     <Exec WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin" Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /s" />   </Target>


Any help would be greatly appreciated.
Thanks
0 Kudos
1 Solution

Accepted Solutions
NeilClemmons
Regular Contributor III
Looks like ESRI has an updated walkthrough for this.  I skimmed through it and it looks like everything you need is in there.  Post back if you have any problems or questions.

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/How_to_deploy_a_custom_...

View solution in original post

0 Kudos
8 Replies
NeilClemmons
Regular Contributor III
Yes, you have to register the dockable window with ArcMap.  It's the same code as registering a command or toolbar only you specify a different component category.  Here's the code that should go in class that implements IDockableWindowDef:

#Region "COM Registration Function(s)"
    <ComRegisterFunction(), ComVisibleAttribute(False)> _
    Public Shared Sub RegisterFunction(ByVal registerType As Type)
        ' Required for ArcGIS Component Category Registrar support
        ArcGISCategoryRegistration(registerType)

        'Add any COM registration code after the ArcGISCategoryRegistration() call

    End Sub

    <ComUnregisterFunction(), ComVisibleAttribute(False)> _
    Public Shared Sub UnregisterFunction(ByVal registerType As Type)
        ' Required for ArcGIS Component Category Registrar support
        ArcGISCategoryUnregistration(registerType)

        'Add any COM unregistration code after the ArcGISCategoryUnregistration() call

    End Sub

#Region "ArcGIS Component Category Registrar generated code"
    ''' <summary>
    ''' Required method for ArcGIS Component Category registration -
    ''' Do not modify the contents of this method with the code editor.
    ''' </summary>
    Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
        Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
        MxDockableWindows.Register(regKey)

    End Sub
    ''' <summary>
    ''' Required method for ArcGIS Component Category unregistration -
    ''' Do not modify the contents of this method with the code editor.
    ''' </summary>
    Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
        Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
        MxDockableWindows.Unregister(regKey)

    End Sub

#End Region
#End Region


How are you deploying this?  If you're using a standard Windows installer then you'll need to add code inside of an Installer class to call esriRegAsm.  If you're using the Add From File method on the Customize dialog I think it will pick up the dockable window but I'm not certain.
0 Kudos
BillMacPherson
New Contributor III
Thank you Neil for your input.
I use a visual studio 10 setup.exe to copy the dll and tlb to the windows XP target machine and I use the Add From File on the Customize dialog to register my ArcMap 10 tools. Everything works fine but the DockableWindow.

The code you suggested is already in my class.

Public Class frmCLApps
    Implements IDockableWindowDef

#Region "COM GUIDs"
    ' These  GUIDs provide the COM identity for this class 
    ' and its COM interfaces. If you change them, existing 
    ' clients will no longer be able to access the class.
    Public Const ClassId As String = "8582b32d-120c-407b-af34-8719b8960b30"
    Public Const InterfaceId As String = "fec13c95-bd53-44cd-b8ef-f7d83f33fbb2"
    Public Const EventsId As String = "1e9d36cc-df74-40c4-a8a7-461a0f75b13d"
#End Region

#Region "COM Registration Function(s)"
    <ComRegisterFunction(), ComVisibleAttribute(False)> _
    Public Shared Sub RegisterFunction(ByVal registerType As Type)
        ' Required for ArcGIS Component Category Registrar support
        ArcGISCategoryRegistration(registerType)

        'Add any COM registration code after the ArcGISCategoryRegistration() call

    End Sub

    <ComUnregisterFunction(), ComVisibleAttribute(False)> _
    Public Shared Sub UnregisterFunction(ByVal registerType As Type)
        ' Required for ArcGIS Component Category Registrar support
        ArcGISCategoryUnregistration(registerType)

        'Add any COM unregistration code after the ArcGISCategoryUnregistration() call

    End Sub

#Region "ArcGIS Component Category Registrar generated code"
    ''' <summary>
    ''' Required method for ArcGIS Component Category registration -
    ''' Do not modify the contents of this method with the code editor.
    ''' </summary>
    Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
        Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
        GMxDockableWindows.Register(regKey)
        MxDockableWindows.Register(regKey)
        SxDockableWindows.Register(regKey)
        GxDockableWindows.Register(regKey)

    End Sub
    ''' <summary>
    ''' Required method for ArcGIS Component Category unregistration -
    ''' Do not modify the contents of this method with the code editor.
    ''' </summary>
    Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
        Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
        GMxDockableWindows.Unregister(regKey)
        MxDockableWindows.Unregister(regKey)
        SxDockableWindows.Unregister(regKey)
        GxDockableWindows.Unregister(regKey)

    End Sub

#End Region
#End Region


After going through my installation on the target machine, I searched the registry for the key "8582b32d-120c-407b-af34-8719b8960b30". It was in the registry associated with my form that implements IDockableWindowDef.

So, I'm still missing some critical part here.

Thanks again for the help.
0 Kudos
NeilClemmons
Regular Contributor III
You can try a couple of things.  Use Categories.exe (located in the ArcGIS Desktop bin directory) to see if the dockable window is listed under ESRI Mx Dockable Windows.  If it isn't, then that means Add from File isn't registering the class.  You should be able to use this utility to register the dockable window.  Personally, I use the setup to do all of the registration.  If you want to try that then let me know and I can tell you how to do that.
0 Kudos
BillMacPherson
New Contributor III
Neil, If you could tell me how to register with the setup, I would be most grateful.
0 Kudos
NeilClemmons
Regular Contributor III
Looks like ESRI has an updated walkthrough for this.  I skimmed through it and it looks like everything you need is in there.  Post back if you have any problems or questions.

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/How_to_deploy_a_custom_...
0 Kudos
BillMacPherson
New Contributor III
Thanks Neil. I looked at the documentation and that is quite a process. I'll go through it and hopefully all will go well. I'll let you know if I can get it to work or ask more questions. This may take a day or two.
0 Kudos
BillMacPherson
New Contributor III
That solution worked Neil. Thanks again. You are the best.

Bill
0 Kudos
RamizelLegada
New Contributor
guys what's wrong when i can see the dockable window and tools,toolbar i created in categories.exe..but when i opened my arcmap i can only see my tools and toolbar but there's no dockable window.,what am i missing?
0 Kudos