I am trying to add a button to the main toolbar next to the green run button. I am only able to add a button under the menus like project, and build etc. Does anyone have any code I could use to get the button to show up next to the run button?
-
see my update to check if it's helpful. You can easily create a Toolbar by the `Adding a ToolBar` document, after that change the parent element and you can add the Toolbar to where the green button exists. then use Tools=>customize to manage their position to meet your needs. If it's helpful, please consider marking it as answer, thanks:) If it work, please let me know. – LoLance Jun 12 '19 at 06:27
1 Answers
1.What you want is to add a ToolBar, you can get the guide from this document: Adding a ToolBar.
After that, you can see your Button in Toolbar group not in menu group.
2.And to get the button to show up next to run button:
In vs, you can go Tools menu=>customize to manage your Toolbar settings. The run button you mentioned belongs to standard Toolbar, you can find the content here:
You can use the Move Up and Move down to control button position in Standard ToolBar group. But as the toolbar we developed doesn't belong to this group, we can't control our toolbar directly in this page.
My suggestion is that we can change the run button to the last one of Standard Group, then move the group where exists custom Toolbar next to the Standard group. The pic should be like:
There might be some way to add the custom toolbar to Standard Group, but i haven't find any related info about this. Also, the guidStandardCommandSet2K seems not to work for this situation. (Hope i didn't misunderstand anything:))
Update:
I've found the Standard Group ID here.
After we've made our custom Toolbar, change the content of Groups section:
<Groups>
<Group guid="guidToolbarTestCommandPackageCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
</Group>
<Group guid="guidToolbarTestCommandPackageCmdSet" id="ToolbarGroup"
priority="0x0000">
<!--Do the changes here, and our custom button will be added into standard Toolbar-->
<Parent guid="guidSHLMainMenu" id="IDM_VS_TOOL_STANDARD"/>
</Group>
</Groups>
All we need is to set the parent element to <Parent guid="guidSHLMainMenu" id="IDM_VS_TOOL_STANDARD"/>
. Then we can find our command in the Standard Toolbar, then use Move up or Move down to modify the position:

- 25,666
- 1
- 39
- 73