UID Editor

2500
7
11-26-2009 03:29 AM
SaschaFricke
New Contributor
Hi,

what's the UID for the ArcGIS Editor?

        Dim pCmdBars As ESRI.ArcGIS.Framework.ICommandBars
        pCmdBars = pDoc.CommandBars
        Dim pUID As New ESRI.ArcGIS.esriSystem.UID
        pUID = New ESRI.ArcGIS.esriSystem.UID
        pUID.Value = "esriEditor.EditorToolBar"
        Dim pCmdBar As ESRI.ArcGIS.Framework.ICommandBar
        pCmdBar = pCmdBars.Find(pUID)

pCmdBar is nothing in ArcGIS 9.4. It works in ArcGIS 9.2 and 9.3.

Best regards
Sascha Fricke
0 Kudos
7 Replies
by Anonymous User
Not applicable
The 'new' editing toolbar in 9.4 has a different ID and GUID from previous versions.
If you revert to the 'classic' toolbar in 9.4 (currently an editor option that will be moved to the arcmap settings exe) you can use the older ID and GUID.

The following code shows the new ID and GUID:

Dim pCmdBars As esriFramework.ICommandBars
Set pCmdBars = Document.CommandBars
Dim pUID As New esriSystem.UID

pUID.Value = "{605F0528-1B64-4862-93B1-484A2C534EA3}" 'new toolbar guid
'pUID.Value = "esriEditor.EditingToolbarNew" 'new toolbar id
'pUID.Value = "{C671B640-83B9-11D2-850C-0000F875B9C6}" 'classic toolbar guid
'pUID.Value = "esriEditor.EditorToolBar" 'classic toolbar id

Dim pCmdItem As esriFramework.ICommandItem
Set pCmdItem = pCmdBars.Find(pUID)
Dim pCmdBar As esriFramework.ICommandBar
Set pCmdBar = pCmdItem
0 Kudos
SaschaFricke
New Contributor
Hi,

thanks for reply. Now I get the new editing toolbar in 9.4. But when I add an custom label to the toolbar, ArcMap crashed with a cryptically error report. Before the crash is coming I get an error message, witch is thrown in the esri.arcgis.framework. This is the message:

�??An attempt was made to read protected memory or write. This is often an indication that other memory is corrupt.�?�

For a short moment, before ArcMap is crashing, I can see my own label. It�??s shown about the text of the editor.

Here is my code:
        Try
            Dim pDoc As ESRI.ArcGIS.Framework.IDocument
            pDoc = ClassGlobalExt.App.Document

            'Get all Commandbars
            Dim pCmdBars As ESRI.ArcGIS.Framework.ICommandBars
            pCmdBars = pDoc.CommandBars

            'Get the Editor Toolbar
            Dim pUID As New ESRI.ArcGIS.esriSystem.UID
            pUID = New ESRI.ArcGIS.esriSystem.UID
            'pUID.Value = "esriEditor.EditingToolbarNew"
            pUID.Value = "{605F0528-1B64-4862-93B1-484A2C534EA3}"
            Dim pCmdBar As ESRI.ArcGIS.Framework.ICommandBar
            pCmdBar = pCmdBars.Find(pUID)

            'Get my own Label
            Dim pLblEditUID As New ESRI.ArcGIS.esriSystem.UID
            pLblEditUID.Value = "{92d26706-91eb-43b4-9c8e-c0506745b9f5}"

            Dim pItem As ICommandItem
            'Find label on Editortoolbar
            pItem = pCmdBar.Find(pLblEditUID)
            If pItem Is Nothing Then
                'Label not found, add
                pItem = pCmdBar.Add(pLblEditUID) 'Here is ArcMap crashing
            End If
            pItem.Refresh()
        Catch ex As Exception
            DoErrorHandling(ex)
        End Try

What�??s wrong? How can I add custom elements to the editor toolbar?

Here is the header of my own label:

Public Class clsLblEdit
    Implements ESRI.ArcGIS.SystemUI.ICommand
    Implements ESRI.ArcGIS.SystemUI.IToolControl
    Implements ESRI.ArcGIS.Framework.ICommandItem
    Private m_Label As New System.Windows.Forms.Label
    Private m_pCompletionNotify As ICompletionNotify

It work�??s under 9.2 and 9.3 very fine, but not under 9.4, for the moment.

Best regards
Sascha Fricke
0 Kudos
by Anonymous User
Not applicable
Assuming your custom class has an explicit guid and com registration functions within it then your probably just missing the esriregasm.exe step required for 9.4. I tried adding a custom class to a toolbar without this step and had the same crash.

You can either right click the custom dll and select 'register 9.4 assembly' or use esriregasm.exe from the command line. You can find esriregasm.exe in C:\Program Files\Common Files\ArcGIS\bin.
0 Kudos
SaschaFricke
New Contributor
Hi,

thanks for help. My class has an explicit guid and com registration functions within, that�??s right. I registered the dll with the esriregasm.exe and about the context menu. Always the class is successful registered, but it doesn�??t works.

You said, that you had the same crash and if you registered the custom dll it work�??s. So what�??s wrong in my approach?

That�??s my code to register the dll:
"<arcgis bin dir>\esriregasm.exe" /v 9.4 /s /p Desktop "<path to custom dll>"

Do you need more information about this to help me?

Best regards
Sascha Fricke
0 Kudos
by Anonymous User
Not applicable
Im not sure what could be going wrong. Can you add the command from the customize mode dialog to a toolbar manually and does it work?
Drop the silent mode also from esrregasm and see if thats working properly too.
Thanks
0 Kudos
SaschaFricke
New Contributor
Hi,

I tried to add the command from the customize mode dialog, but while ArcMap opens the dialog it crashed.
I think I�??ve found the problem. But I don�??t now a solution. My command that I try to put on the editor toolbar implements the following interfaces:

    Implements ESRI.ArcGIS.SystemUI.ICommand
    Implements ESRI.ArcGIS.SystemUI.IToolControl
    Implements ESRI.ArcGIS.Framework.ICommandItem

The interface IToolControl needs the function hWnd:
My command has a label, so I try:

    Public ReadOnly Property hWnd() As Integer Implements ESRI.ArcGIS.SystemUI.IToolControl.hWnd
        Get
            Return m_Label.Handle.ToInt32
        End Get
    End Property

That doesn�??t work. So I try:

Return m_Label.Handle
Return m_Label.Handle.ToInt64()
Return m_Label.Handle.ToString

For each return ArcMap crashed.
How implement you the IToolControl interface? I know�??n the example:
http://help.esri.com/en/sdk/9.4/Arcobjects_net/ComponentHelp/index.htm#/d/003W0000006T000000/

I don�??t know that�??s the error. But I will now test step by step.

Best regards
Sascha Fricke
0 Kudos
SaschaFricke
New Contributor
Hi,

I have the solution. I visited ESRI Germany and got there help.
At first, I give up the interface ICommandItem.
The second point is that my button has no bitmap and so I change the following code from:

    Public ReadOnly Property Bitmap() As Integer Implements ESRI.ArcGIS.SystemUI.ICommand.Bitmap
        Get
            Return -1
        End Get
    End Property

to:

    Public ReadOnly Property Bitmap() As Integer Implements ESRI.ArcGIS.SystemUI.ICommand.Bitmap
        Get
            Return 0
        End Get
    End Property

Than it works.

Thanks to J. Manegold for help.

Best regards
Sascha Fricke
0 Kudos