e.g. Consider the following code:
<Group guid="guidFirstCommandCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
</Group>
<Group guid="guidSecondCommandCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
</Group>
Here, why do we need to define both GUID and ID? id="IDM_VS_MENU_TOOLS" refers to Tools menu in Visual Studio. What is the use of guid="guidSHLMainMenu"?
Also consider the following code:
<Button guid="guidSecondCommandCmdSet" id="cmdidSecondCommand" priority="2" type="Button">
<Parent guid="guidSecondCommandCmdSet" id="MyMenuGroup"/>
<Icon guid="guidImages" id="bmpPic2"/>
<Strings>
<ButtonText>XXX Command</ButtonText>
</Strings>
</Button>
I understand that the button has the id called "cmdidSecondCommand", but where would the GUID of the button be used? We are already defining the Parent container of the button in the next element.
A GUID
is as the name implies a globally unique identifier in the form of {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
. An ID
is a key (or identifier); which is used like a constant allowing to give descriptive names to numeric values.
Since the values behind an ID
are not unique over all command sets (or image-strips), the GUID
is used to put them into context... a combination of a guid and a numeric value is used to uniquely identify groups, menus, toolbars, buttons, images etc...
In the given example MyMenuGroup
and IDM_VS_MENU_TOOLS
could potentially have the same mumeric value, but the guids guidSecondCommandCmdSet
and guidSHLMainMenu
put them into context...
<Group guid="guidSecondCommandCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
</Group>
You need the GUID
and the ID
when you want to register Execute- and QueryStatus handlers for controls in your code, set an icon for a button, set elements into relation; for instance adding a group to a toolbar, or menu and so on...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With