You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcObjects General forum

Custom Extension Problem   Erik Lee Jan 18, 2010
Re: Custom Extension Problem   Neil Clemmons Jan 19, 2010
Re: Custom Extension Problem   Erik Lee Jan 19, 2010
Re: Custom Extension Problem   Scott Davis Mar 30, 2010
Re: Custom Extension Problem   Kirk Kuykendall Mar 30, 2010
Re: Custom Extension Problem   Erik Lee Mar 30, 2010
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Custom Extension Problem 
Author Erik Lee 
Date Jan 18, 2010 
Message I'm having problems getting my custom extension, toolbar, and TOC tab to display in ArcMap. I'm using C# Visual Studio 2008, ArcGIS 9.3.1. My Extension project contains the IExtension template (complete with IExtensionConfig), the custom toolbar via BaseToolbar, and a custom ToC tab via IContentsView, along with the Installer Class template and COM registration code as described in a guide here on this site. They were all created with the SDK templates so they all have the COM registration functions. I also have 3 ICommand objects, in separate projects, all of which show up in Tools -> Customize -> Commands (however the toolbar is not showing up in Tools-Customize -> Toolbars).

Using catagories.exe, I can see everything is located in their proper locations:

.NET Catagory
(all are referenced here)

ESRI Mx Extensions:
"ETS.ETSExtension.ETSExtension"

ESRI Contents Views:
"ETS.ETSExtension.ETSToCTab"

ESRI Mx Command Bars:
"ETS.ETSExtension.ETSToolbar"

ESRI.Mx Commands:
"ETS.PingCmd.PingCmd"
"ETS.GetDrawingsCmd.GetDrawingsCmd"
"ETS.XfmrSizingCmd.XfmrSizingCmd"

I'm assuming thre's something wrong with my Extension project, because all 3 items within that project are not showing up in ArcMap (extension, toolbar, and toc tab). Each command is in its own project, and they work fine (and everything is referenced by 1 solution file and 1 setup project).

I used to have a toolbar as the master project with all the commands located within the project, and that installed just fine. As this thing grew, however, I found the need for expansion via a custom extension, toc tab, etc. I pretty much did everything the same this time around.

And I do reboot each time I install it.

I noticed the ProgID attribute doesn't seem to be overriding my namespace and class naming, so I commented it out (read in the reference section that's OK to do).

I also have it set to install for all users. Are there specific registry keys I need to be looking for? I'm assuming the install is fine since I can see it all using the categories tool.

Pleas help, I'm starting to pull out my hair!

Thanks!

Erik
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Custom Extension Problem 
Author Neil Clemmons 
Date Jan 19, 2010 
Message When you run your installer, it is the installer class that is responsible for registering your classes in the ESRI component categories. Each project in the solution that contains classes that need to be registered will need an installer class (along with an associated custom action to kick it off). Have you done this or do you just have the one installer class for your original project? 
  Neil Clemmons
Senior GIS Developer
Geographic Information Services, Inc.
Birmingham, AL
http://www.gis-services.com

Check out our blog:
http://blog.gis-services.com/ 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Custom Extension Problem 
Author Erik Lee 
Date Jan 19, 2010 
Message I have an installer class for each project. 1 for the extension project (which contains the extension, toc tab, and toolbar), and 1 for each of the 3 commands. I then went into the setup project and set custom actions for install/uninstall as the primary output of each project.

The odd thing I initially noticed (and forgot to mention previously) was that because the command projects had a dependency on the extension project, the extension DLL was in the "detected dependancies" list causing there to essentially be 2 of those dll installed in the Application folder (one from the primary output custom action, and 1 from being included as a dependancy). So I "excluded" the dll in the Detected Dependancies and kept the primary output custom action.

Maybe that has something to do with it? 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Custom Extension Problem 
Author Scott Davis 
Date Mar 30, 2010 
Message I'm having the same problem. Did you ever find a solution? 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Custom Extension Problem 
Author Kirk Kuykendall 
Date Mar 30, 2010 
Message If Categories.exe lists a toolbar in "ESRI Mx Commandbars" but Arcmap doesn't show it in Customize>Toolbars then I would suspect the toolbar cannot be instantiated, or that it does not implement IToolbardef/IMenuDef.

Maybe run the vba code below on the deployment machine to see if you get an error.

Also, you might try clearing registry keys in:
HKEY_CURRENT_USER\Software\ESRI\ArcMap\Settings\CommandBarNameCache 
 
Option Explicit
Sub ListCategory()
    Dim pCF As ICategoryFactory
    Set pCF = New CategoryFactory
    Dim pUID As New UID
    ' ESRI Mx Commandbars catid
    pUID.Value = "{B56A7C4A-83D4-11d2-A2E9-080009B6F22B}"
    pCF.CategoryID = pUID
    Dim pUnk As IUnknown
    Set pUnk = pCF.CreateNext()
    Do Until pUnk Is Nothing
        If TypeOf pUnk Is IToolBarDef Then
            Dim pTBD As IToolBarDef
            Set pTBD = pUnk
            Debug.Print "Toolbar: " & pTBD.Name
        ElseIf TypeOf pUnk Is IMenuDef Then
            Dim pMD As IMenuDef
            Set pMD = pUnk
            Debug.Print "Menu: " & pMD.Name
        Else
            Debug.Print "object does not implement itoolbardef or imenudef"
        End If
        Set pUnk = pCF.CreateNext()
    Loop
End Sub
 
  Kirk Kuykendall
AmberGIS Programming Services & Sales
http://www.ambergis.com
Now Answering questions at:
http://gis.stackexchange.com/


 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Custom Extension Problem 
Author Erik Lee 
Date Mar 30, 2010 
Message The Extension object was throwing an exception in the constructor that was being eaten/hidden by ArcMap. I do some initialization in the constructor, made a change and forgot to test that particular change. I have since put a try/catch block in the extension constructor and do a 'MessageBox.Show(ex.ToString())' to show the exception.

Since I default the visibility/enabled state of all commands, toolbars, ToC tab, etc. to 'off' and turn them on via role checking in the extension, they defaulted to be disabled/hidden state.