在使用ArcMap IItemDef 的時候 我們需要實現IToolBar,然後在STDMETHOD(GetItemInfo)(long pos, IItemDef * itemDef){} 裏填入Command的ProID,樓主翻閱了很多arcgis文檔,才找到的,分享出來。
STDMETHOD(GetItemInfo)(long pos, IItemDef * itemDef)
{
HRESULT hr = S_OK;
m_ToolDefArr.RemoveAll();
ToolDef def1((_bstr_t)_T("esriCore.AddDataCommand"),VARIANT_FALSE,-1);
//ToolDef
// ToolDef def6((_bstr_t)_T("esriCore.SketchTool"), VARIANT_FALSE, -1); // 編輯 草圖工具
ToolDef def7((_bstr_t)_T("esriEditorExt.ConstructCommand"), VARIANT_FALSE, -1); // 構造面
m_ToolDefArr.Add(def1);
// m_ToolDefArr.Add(def6);
m_ToolDefArr.Add(def7);
if (NULL == itemDef)
{
return E_NOTIMPL;
}
(*itemDef).put_ID(m_ToolDefArr[pos].itemDef);
(*itemDef).put_Group(m_ToolDefArr[pos].group);
(*itemDef).put_SubType(m_ToolDefArr[pos].subType);
return S_OK;
}
ArcMap commands |
The information in this topic is useful if you're trying to programmatically find a built-in command, menu, or toolbar. The ICommandBars.Find and ICommandBar.Find methods can be used to get a reference to a specific toolbar, menu, or command. Both of these methods require the unique identifier (UID) of the object you're trying to find.
This table contains the following information:
- Caption, name, and globally unique identifier (GUID) of the built-in toolbars in ArcMap.
- Caption, name, GUID, and parent of the built-in menus in ArcMap.
- Caption, name, command category (category in the Customize dialog box), GUID, SubType, parent, and description of the built-in commands that appear on the toolbars and menus in ArcMap.