
Signature
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
There are several things involved here.
- First, terminology: you have CommandBars and CommandBarControls (or
buttons), which you are using indistinctly while they are quite different.
- You can create any number of command bars and command bar controls for any
add-in.
- In order to support commands, your connect class must implement
EnvDTE.IDTCommandTarget, and in the QueryStatus method you must return
StatusOption = vsCommandStatus.vsCommandStatusEnabled |
vsCommandStatus.vsCommandStatusSupported;
if the passed command name is one of your add-in.
- The ext_ConnectMode.ext_cm_UISetup flag is passed only once to your
add-in. But since the commands are created in the debugged IDE and you close
it before the first IDE (The one with the addin code), when you close this
first instance its overwrites changes of the second IDE and therefore the
commands are removed. Also, if you wrote the code to add the first control,
executed it, the UISetup flag was passed and later you added the code to add
the second control, the UISetup flag is not passed again and your second
control does not show. Maybe this explains you behaviour. You can force a
UISetup again reinstalling the add-in or changing manually the
CommandPreload registry entry of your addin to reset it from 1 to 0
(assuming that your addin uses machine installation, not user-installation,
which uses a different registry key).
-You can bind keyboard shortcuts to commands using the Command.Bindings
property, assuming that the user is not using a predefined keyboard mapping
scheme but a copy (Options window, Keyboard node).

Signature
Carlos J. Quintero (Visual Developer - .NET MVP)
FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
addins:
http://groups.yahoo.com/group/vsnetaddin/ (free join)
> Is it possible to do the following:
>
[quoted text clipped - 36 lines]
> "Executes the command for HelpBuilderAutomation2",true, 59,
> ref contextGUIDS2,
(int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommand
> StatusEnabled);
>
[quoted text clipped - 10 lines]
>
> +++ Rick ---
Rick Strahl [MVP] - 29 Jun 2004 21:13 GMT
Carlos,
Thanks so much for all of your help.
The missing link here was the QueryStatus and enabling of the commands. Now
I get both buttons and they are firing!
I ended up buying a book which should arrive in a couple of days. Hopefully
this will let me
get a little more of the big picture of interrelated parts of this process.
I sure hope MS goes through this in the future and provides a cleaner more
object based way
using pure .Net code to hook into these shells.
Thanks again for your help, Carlos.
+++ Rick ---

Signature
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
> There are several things involved here.
>
[quoted text clipped - 71 lines]
> > "Executes the command for HelpBuilderAutomation2",true, 59,
> > ref contextGUIDS2,
(int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommand
> > StatusEnabled);
> >
[quoted text clipped - 10 lines]
> >
> > +++ Rick ---