Hide Table of Contents
AddMenuPopupIcon Method (IFrame)

Adds an icon to a context-sensitive menu of a C++ SolidWorks add-in.

.NET Syntax

Visual Basic (Declaration) 
Function AddMenuPopupIcon( _
   ByVal DocType As Integer, _
   ByVal SelectType As Integer, _
   ByVal HintString As String, _
   ByVal CallbackFcnAndModule As String, _
   ByVal CustomNames As String, _
   ByVal BitmapFilePath As String _
) As Boolean
Visual Basic (Usage) 
Dim instance As IFrame
Dim DocType As Integer
Dim SelectType As Integer
Dim HintString As String
Dim CallbackFcnAndModule As String
Dim CustomNames As String
Dim BitmapFilePath As String
Dim value As Boolean
 
value = instance.AddMenuPopupIcon(DocType, SelectType, HintString, CallbackFcnAndModule, CustomNames, BitmapFilePath)
C# 
bool AddMenuPopupIcon( 
   int DocType,
   int SelectType,
   string HintString,
   string CallbackFcnAndModule,
   string CustomNames,
   string BitmapFilePath
)
C++/CLI 
bool AddMenuPopupIcon( 
&   int DocType,
&   int SelectType,
&   String^ HintString,
&   String^ CallbackFcnAndModule,
&   String^ CustomNames,
&   String^ BitmapFilePath
) 

Parameters

DocType
Document type to which to add the context-sensitive menu icon
SelectType
Selection type to which to add the context-sensitive menu icon
HintString
Text displayed in the SolidWorks status bar when the user moves the mouse over the icon
CallbackFcnAndModule
Function called when user clicks the context-sensitive menu icon (see Remarks)
CustomNames
Names of custom feature types (see Remarks)
BitmapFilePath
Path and filename of the bitmap for the context-sensitive menu icon

Return Value

True if the context-sensitive menu icon is added, false if not

Example

C++$$copyCode$$
//Add a single icon to the standard 
//SolidWorks face context menu. 
swFrame->AddMenuPopupIcon( 
swDocPART, 
swSelFACES, 
CComBSTR(_T("UserPopupMenus.dll@MinibarItem1_Menu1_Callback,Facehintstring")), 
CComBSTR(_T("UserPopupMenus.dll@MinibarItem1_Menu1_Callback")), 
CComBSTR(_T("")), 
UserItem1_Menu1_bitmapFile, 
&iconSuccess 
);

Remarks

This method is supported in C++ applications only, and it only works for C++ applications implemented as DLLs, not as EXEs. Any function exposed as a callback from an context-sensitive menu icon must be declared as an EXPORT or included in your .def file.

The CallbackFcnAndModule argument specifies which function to call when the shortcut menu icon is clicked by the user. The syntax is as follows:

"dllname@function" where:

dllname

Name of your library as specified in the project .def file. The actual DLL filename and the definition in the .def file must be the same.

function

Name of the function that gets called when the user clicks the icon. This function must also be declared as an EXPORT in your .def file.

See Add-in Callback and Enable Methods to learn how to implement your callback function.

CustomNames is semi-colon separated list of the names of the custom feature types. This argument is applicable only if SelectType is a custom feature type (like swSelATTRIBUTES); in the case of swSelATTRIBUTES, set this field to the name of the attribute definition.

 

See Also

Availability

SolidWorks 2010 FCS, Revision Number 18.0


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   AddMenuPopupIcon Method (IFrame)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2012 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.