API: Create User-Defined Popup Menus and Context-Sensitive Menu Icons

Version 7


    A C++ add-in that demonstrates how to create popup menus and context-sensitive menu icons using IFrame::AddMenuPopupIcon, SldWorks::AddItemToThirdPartyPopupMenu, and SldWorks::ShowThirdPartyPopupMenu. This add-in also demonstrates the use of the IMouse interface and how to handle SolidWorks mouse events.



    1. Copy Toolbar1.bmp, Toolbar2.bmp, Toolbar3.bmp, and Toolbar4.bmp to c:\test.
    2. Open the project and rebuild the solution.
    3. Start SolidWorks and add the UserPopupMenus add-in.
    4. Open a part document with solid geometry.
    5. Select User Popup Menus > Add Popup Menu and Context-sensitive Menu Icon.
    6. Select a face and observe the newly added context-sensitive icon (a checkmark).
    7. Click the icon, observe the message box, and close it.
    8. Click in an empty area of the SolidWorks graphics window and observe the newly added popup menu and items.
    9. Click any item, observe the message box, and close it.


      Toggle Popup Menu Visibility turns the visibility of the popup menu on and off after adding it. Remove Context-sensitive Menu Icon removes the icon after adding it. To restore the icon to the context-sensitive menu, select Add Popup Menu and Context-sensitive Menu Icon again.



      SolidWorks 2010 SP0 or later




      - Subscription Services required for full access.

      - Looking for more API Examples?


      Copyright © 2011 Dassault Systèmes SolidWorks Corp. All rights reserved.
      Do not distribute or reproduce without the written consent of Dassault Systèmes SolidWorks Corp.