Hide Table of Contents
AddToolbar4 Method (ISldWorks)

Creates a Windows-style, dockable toolbar that contains a set of application-defined buttons.

.NET Syntax

Visual Basic (Declaration) 
Function AddToolbar4( _
   ByVal Cookie As System.Integer, _
   ByVal Title As System.String, _
   ByVal SmallBitmapImage As System.String, _
   ByVal LargeBitmapImage As System.String, _
   ByVal MenuPositionForToolbar As System.Integer, _
   ByVal DocumentType As System.Integer _
) As System.Integer
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim Cookie As System.Integer
Dim Title As System.String
Dim SmallBitmapImage As System.String
Dim LargeBitmapImage As System.String
Dim MenuPositionForToolbar As System.Integer
Dim DocumentType As System.Integer
Dim value As System.Integer
value = instance.AddToolbar4(Cookie, Title, SmallBitmapImage, LargeBitmapImage, MenuPositionForToolbar, DocumentType)
System.int AddToolbar4( 
   System.int Cookie,
   System.string Title,
   System.string SmallBitmapImage,
   System.string LargeBitmapImage,
   System.int MenuPositionForToolbar,
   System.int DocumentType
System.int AddToolbar4( 
&   System.int Cookie,
&   System.String^ Title,
&   System.String^ SmallBitmapImage,
&   System.String^ LargeBitmapImage,
&   System.int MenuPositionForToolbar,
&   System.int DocumentType



Resource ID of the toolbar; this is the same cookie that you specified in ISwAddin::ConnectToSW


Title of the toolbar


Bitmap file to use for the small bitmap for the toolbar (see Remarks)


Bitmap file to use for the large bitmap for the toolbar (see Remarks)


Not used (SolidWorks always puts toolbar names in alphabetical order)


Bitwise values indicating what frame window types should have this toolbar's name added to the View, Toolbars menu; values from swDocTemplateTypes_e

Return Value

Toolbar ID for use with other methods or -1 if not created



For information about using this method with the ISwAddin object, see Using ISwAddin to Create a SolidWorks Add-in.


This method:

  • Only operates properly when the application is implemented as a DLL and not as an .exe.

  • Adds the toolbar name to the View, Toolbars menu.

  • Only creates the toolbar and passes the image for the buttons to SolidWorks. To add functionality, use ISldWorks::AddToolbarCommand2.

The bitmap images should contain the bitmaps for each of the buttons, including separators, in the toolbar as a single bitmap. For a small bitmap, the image for each button must be 16x16; for a large bitmap, it must be 24x24. The bitmaps should use a 256-color palette. Use gray (RGB 192, 192, 192) for transparent areas in your bitmap.


If either SmallBitmapImage or LargeBitmapImage is NULL or empty, then the provided image is scaled to create the appropriately sized bitmap for the other argument.



  • When your add-in is unloaded, you must call ISldWorks::RemoveToolbar2 to remove this toolbar.

  • If you want the toolbar to show up in specific locations only, do not use the now obsolete ISldWorks::ShowToolbar2 method. If your application uses that method, your application ignores the DocumentType argument. ISldWorks::ShowToolbar2 assumes that the application is controlling the visibility state of the toolbar, and not the user. This means that the toolbar will be available in all locations.


See Also


SolidWorks 2004 FCS, Revision Number 12.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

Subject:   Feedback on Help Topics
Page:   AddToolbar4 Method (ISldWorks)
*   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:


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

Web Help Content Version: API Help (English only) 2013 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.