AnsweredAssumed Answered

Task Add-in - Show on menus

Question asked by Mike Gann on Apr 30, 2014
Latest reply on May 1, 2014 by Mike Gann

I'm working with the Task Add-in  example located here:

 

http://help.solidworks.com/2014/English/api/epdmapi/tasksample.htm

 

I'm able to compile it and so far the example looks to be working. However I can't get the Task Add-in to show on any menu. Below is the code from the onTaskSetup procedure that should add it to the menu.

 

I've tried setting the flag (cmds(0).mlEdmMenuFlags = EdmMenuFlags.EdmMenu_ShowInMenuBarAction) to various values but I still can't get this to show up anywhere.

 

Thanks,

 

Mike

 

Sub OnTaskSetup(ByRef poCmd As EdmCmd, ByRef ppoData As System.Array)

 

 

        Dim props As IEdmTaskProperties

        props = poCmd.mpoExtra

 

 

        'Turn on some properties, e.g., the task can be launched during a

        'state change, can extend the details page, is called when the

        'task is launched, and supports scheduling

        props.TaskFlags = EdmTaskFlag.EdmTask_SupportsChangeState + EdmTaskFlag.EdmTask_SupportsDetails + EdmTaskFlag.EdmTask_SupportsInitExec + EdmTaskFlag.EdmTask_SupportsScheduling

 

 

        'Set menu commands that launch this task from Windows Explorer

        Dim cmds(0) As EdmTaskMenuCmd

        cmds(0).mbsMenuString = "Run the test task"

        cmds(0).mbsStatusBarHelp = "This command runs the task add-in"

        cmds(0).mlCmdID = 1

        cmds(0).mlEdmMenuFlags = EdmMenuFlags.EdmMenu_ShowInMenuBarAction

        props.SetMenuCmds(cmds)

 

 

        'Add a custom setup page; SetupPage is a user control with an

        'edit box; SetupPage::LoadData populates the edit box from a

        'variable in IEdmTaskProperties; saving of properties is handled

        'by OnTaskSetupButton

        currentSetupPage = New SetupPage

        currentSetupPage.CreateControl()

        currentSetupPage.LoadData(poCmd)

 

 

        Dim pages(0) As EdmTaskSetupPage

        pages(0).mbsPageName = "Test Add-in page"

        pages(0).mlPageHwnd = currentSetupPage.Handle.ToInt32

        pages(0).mpoPageImpl = currentSetupPage

 

 

        props.SetSetupPages(pages)

    End Sub

Outcomes