AddMenu Method (IApplication)

AddMenu Method (IApplication) | Send Feedback
See Also

Item[out]
  Menu item

ApiUuid

  UUID of the add-in or non add-in application

UiState
  Where to add the menu item as defined in dsUIState_e

Position
  Position of the menu item

MenuName
  Name of the menu item

Adds a menu item to the DraftSight user interface.

# Syntax

Visual Basic |
--- | ---
    Function AddMenu( _
       ByVal ApiUuid As System.String, _
       ByVal UiState As dsUIState_e, _
       ByVal Position As System.Integer, _
       ByVal MenuName As System.String _
    ) As MenuItem

C# |
--- | ---
    MenuItem AddMenu(
       System.string ApiUuid,
       dsUIState_e UiState,
       System.int Position,
       System.string MenuName
    )

JavaScript |
--- | ---
    AddMenu(
       ApiUuid : String,
       UiState : String,
       Position : Number,
       MenuName : String
    ) : dsMenuItem

COM native C++ |
--- | ---
    HRESULT AddMenu(
       BSTR ApiUuid,
       dsUIState_e UiState,
       LONG Position,
       BSTR MenuName,
       IMenuItem** Item
    )

C++ |
--- | ---
    DSRESULT AddMenu(
       const dsString& ApiUuid,
       dsUIState_e UiState,
       long Position,
       const dsString& MenuName,
       dsMenuItem** Item
    )

#### Parameters

ApiUuid

  UUID of the add-in or non add-in application

UiState
  Where to add the menu item as defined in dsUIState_e
Position
  Position of the menu item
MenuName
  Name of the menu item
Item[out] or Return Value
  Menu item

# Example

The following code snippets show how to add a menu item to DraftSight's main menu:

- COM native C++ (from the DraftSight API COM native C++ template file DsAddinConnection.cpp)
- C++ (from the DraftSight API C++ template file dsAddinConnection.cpp)

#### COM native C++

> IMenuItemPtr pMenu = m_DsApp->AddMenu( m_sApiUuid, dsUIState_Document, MENU_POSITION, L"DsAddin" );

#### C++

> dsMenuItem_ptr pMenu;

> dsApp->AddMenu(myApplication::appID, dsUIState_Document, MENU_POSITION, UserCommandName, &pMenu);

# See Also

####

IApplication Interface
IApplication Members
IApplication::GetMenuItems Method

# Availability

DraftSight V1R1