Strange Toolbar Behavior with C++ Addin

I have a need to create a C++ add-in for SOLIDWORKS 2025. The APISDK download includes a C++ add-in wizard, but it is hopelessly tied to Visual Studio 2017. The Visual Studio template system underwent a serious overhaul after 2017 so the old template is not compatible with newer Visual Studio versions and SW hasn’t bothered to update them.

Therefore, I set out to solve the problem by creating a Visual Studio 2022 compatible template for creating SOLIDWORKS C++ add-ins. I’m mostly finished, and it works. I can use the template to create a new SOLIDWORKS add-in project and the project will build and the add-in can be used in SOLIDWORKS. There is just one issue.

The original add-in template creates a VS project and generates the code to add a CommandGroup and a FlyoutGroup to the command manager. Then some custom commands are added to the command group and flyout group to do simple things like start Notepad, display a custom property manager page or show a dialog. The C# and VB.NET templates do something similar. The C# add-in produces this:

The strange thing I’m seeing is that in the C++ add-in, all the code to set this up succeeds, but all I see in the UI is the command group name:

The individual commands, the separator and the flyout are missing. In the actual toolbar, two commands appear, but as you can see they are disabled.

The really strange thing is that if I hover over the commands, the tooltips that appear are completely wrong:


These aren’t even command tooltips. They are error messages associated with the sheet metal stamp feature that normally show up in an error dialog like this:

This shouldn’t even be possible. The tooltips are resources embedded in the add-in DLL file. Showing completely different text from a location outside the add-in DLL is crazy.

Any SOLIDWORKS C++ add-in experts have any idea what might be going on here?

Hi Jim,
could be that the mainCmdGroupID and flyoutGroupID consts are messed up by your multiple tryouts.
What you can try (if the first succeeds don’t go further on the numbers :wink:):

  1. If you use those consts, then set the value for those +1. this will redefine the commands and flyouts hopefully in the registry.

  2. delete the tab in solidworks commandmanager via customize.
    Set addin in addinmanager off. In VS rebuild and the commandmanager should be there again.

  3. unregister the addin with regasm

  4. registry clean up in : HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\AddIns

Just curious — is there a specific reason you’re using C++ for this project? Personally, I prefer C#, as it’s much better supported and more tightly integrated with the SolidWorks API.

Hope this helps — let us know how it goes!

Eddy

The SldWorks::Callback method is hopelessly broken in the C# API. I was testing C++ to see if it was any better. It’s not.

Well, better dead than buggy :relieved_face:

Hi, I’m facing the same issue. Did you ever manage to find a solution or workaround?

I did not. I have not investigated further since this was just a quick test add-in to determine if the SldWorks::Callback method worked correctly in C++. It does not.