AnsweredAssumed Answered

Add-in menu command with toolbar button

Question asked by Nerea Etxeberria on Aug 19, 2013


I followed “Creating a Menu Command with Visual Basic .NET” instructions from “SolidWorks Enterprise PDM Programmer’s Reference Guide” in order to create an add-in that is called from a menu command with toolbar button in Windows Explorer.



Public Sub GetAddInInfo(ByRef poInfo As EdmLib.EdmAddInInfo, ByVal poVault As EdmLib.IEdmVault5, ByVal poCmdMgr As EdmLib.IEdmCmdMgr5) Implements EdmLib.IEdmAddIn5.GetAddInInfo

'Just some information for the Administrate Add-ins dialog box
poInfo.mbsAddInName = "Menu command sample"
  poInfo.mbsCompany = "SolidWorks Corporation"
  poInfo.mbsDescription = "Adds menu items and toolbar buttons"
  poInfo.mlAddInVersion = 1
  poInfo.mlRequiredVersionMajor = 5
  poInfo.mlRequiredVersionMinor = 2

  'Get the handle of the images we created  Dim iNormalBmp As Integer
  Dim iHotBmp As Integer
  iNormalBmp = My.Resources.Resource1.ToolbarNormal.GetHbitmap.ToInt32
  iHotBmp = My.Resources.Resource1.ToolbarHot.GetHbitmap.ToInt32

  'Register the toolbar button images. Each image contains two buttons
  'and we assign the (arbitrary) id 99 to them both. 

poCmdMgr.AddToolbarImage(iNormalBmp, 2, EdmButtonState.BState_Cold, False, True, &HC0C0C0, 99)
poCmdMgr.AddToolbarImage(iHotBmp, 2, EdmButtonState.BState_Hot, False, True, &HC0C0C0, 99)

  'Add a command for each of the buttons. (The command-ID numbers 1000 and 1001 are
  'arbitrary. PDMWE will not use them itself, only pass them on to our
  'implementation of OnCmd so we will know which command was selected.) 
poCmdMgr.AddCmd(1000, "First command", EdmMenuFlags.EdmMenu_HasToolbarButton, "This is the first command", "First command", 0, 99)

poCmdMgr.AddCmd(1001, "Second command", EdmMenuFlags.EdmMenu_HasToolbarButton Or EdmMenuFlags.EdmMenu_MustHaveSelection, "This is the second command", "Second command", 1, 99)

End Sub


I have EPDM 2012 client installed in Windows 7 system and the problem is that add-in buttons do not appear in Windows Explorer Toolbar.

I have read this forum post about this topic and it says buttons are not enabled in Windows 7, that they have been replaced with text. Is this right? If so, how is the code to add text menu commands to windows toolbar?


Thanks in advance,