iCAx开思网

标题: Inventor2008二次开发菜单加载遇到问题! [打印本页]

作者: sunmz_wjxy    时间: 2009-11-17 13:46
标题: Inventor2008二次开发菜单加载遇到问题!
不知道什么原因,现在用Inventor2008二次开发,只要Inventor2008重新启动一次,菜单就会重复加载一次。导致二次开发的菜单越来越多。求救呀!
我的代码如下:
Public Function ssss()
    Dim oControlDefinitions As ControlDefinitions
    Set oControlDefinitions = ThisApplication.CommandManager.ControlDefinitions
   
   
    Set oButtonDefinition1 = oControlDefinitions.AddButtonDefinition( _
                       "Button 1", "invrSampleCommand1", _
                       kQueryOnlyCmdType, "CLSID of the AddIn", _
                       "This is button 1.", "Button 1")
' Create two more button definitions. One with an icon and one without.
Set oButtonDefinition2 = oControlDefinitions.AddButtonDefinition( _
                       "Button 2", "invrSampleCommand2", _
                       kQueryOnlyCmdType, "CLSID of the AddIn", _
                       "This is button 2.", "Button 2")
Set oButtonDefinition3 = oControlDefinitions.AddButtonDefinition( _
                       "Button 3", "invrSampleCommand3", _
                       kQueryOnlyCmdType, "CLSID of the AddIn", _
                       "This is button 3.", "Button 3")
                  
' Get the part environment object.
Dim oUIManager As UserInterfaceManager
Dim oPartEnv As Environment
Set oUIManager = ThisApplication.UserInterfaceManager
Set oPartEnv = oUIManager.Environments.Item("PMxPartEnvironment")
                                            
' Get the command bar that is used for the part menu.
Dim oPartMenuCB As CommandBar
Set oPartMenuCB = oPartEnv.DefaultMenuBar
' Create a command bar of a pop-up type for a flyout.
Dim oFlyOutCmdBar As CommandBar
Set oFlyOutCmdBar = oUIManager.CommandBars.Add("More Commands", _
           "FlyoutCmdBar", kPopUpCommandBar, "CLSID of the AddIn")
' Add two buttons to the fly-out command bar.
Call oFlyOutCmdBar.Controls.AddButton(oButtonDefinition2)
Call oFlyOutCmdBar.Controls.AddButton(oButtonDefinition3)
' Create a command bar of a pop-up type for a menu popup.
Dim oMenuPopupCmdBar As CommandBar
Set oMenuPopupCmdBar = oUIManager.CommandBars.Add("Test", _
           "MenuPopupCmdBar", kPopUpCommandBar, "CLSID of the AddIn")
' Add a command to the menu pop-up.
Call oMenuPopupCmdBar.Controls.AddButton(oButtonDefinition1)
' Add the fly-out to the menu pop-up.
Call oMenuPopupCmdBar.Controls.AddPopup(oFlyOutCmdBar)
' Get the index of the Help control.
Dim HelpIndex As Long
HelpIndex = oPartMenuCB.Controls.Item("AppHelpMenu").index
' Add the menu popup to part menu before the Help control.
Call oPartMenuCB.Controls.AddPopup(oMenuPopupCmdBar, HelpIndex)
End Function
作者: sunmz_wjxy    时间: 2009-11-23 15:50
哇靠!就没个高手帮帮忙?????
急呀
作者: sunmz_wjxy    时间: 2009-12-1 10:36
我在Inventor2008退出事件中删除菜单也不行。
难道没有人遇到过这个问题吗????
作者: sunmz_wjxy    时间: 2009-12-23 11:11
这么久都没人回答。。。





欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3