Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
tools
vsnet.act
vsnet.debugging
vsnet.documentation
vsnet.enterprise.tools
vsnet.general
vsnet.ide
vsnet.jlca
vsnet.servicepacks
vsnet.setup
vsnet.vsip
vsnet.vss
vsnet.vstools.office
vstudio.development
vstudio.extensibility
vstudio.general
vstudio.helpauthoring
vstudio.setup
vstudio.sourcesafe
  
 
date: Wed, 28 May 2008 02:26:43 -0700 (PDT),    group: microsoft.public.vstudio.extensibility        back       


Invoke a menu command   
Hi all,

       i need to call a command in the main menu of VS (exactly the
"Connect to Server" one).

I'm doing the following:

OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as
OleMenuCommandService;
if (null != mcs)
{
            int commandid = 0;
            CommandID conntoserver = new
CommandID(VsMenus.guidSHLMainMenu, commandid);
            mcs.FindCommand(conntoserver).Invoke();

}

But I cant find anyware a list of (constants?) ids of commands in vs
menus.

Any suggestion?

TIA

--
Layos
date: Wed, 28 May 2008 02:26:43 -0700 (PDT)   author:   layos

Re: Invoke a menu command   
Start the macro recorder - tools - macros etc.  then punch that menu item 
manually and see what the macro VB script spits out.

It'll be what you can call in your code.

If that doesn't work there are a few addins out there that you can use to 
get the CommandID for your specific item of interest.

-jeff

"layos"  wrote in message 
news:9381cc06-e663-4084-9e96-276d781cdb79@34g2000hsh.googlegroups.com...
> Hi all,
>
>       i need to call a command in the main menu of VS (exactly the
> "Connect to Server" one).
>
> I'm doing the following:
>
> OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as
> OleMenuCommandService;
> if (null != mcs)
> {
>            int commandid = 0;
>            CommandID conntoserver = new
> CommandID(VsMenus.guidSHLMainMenu, commandid);
>            mcs.FindCommand(conntoserver).Invoke();
>
> }
>
> But I cant find anyware a list of (constants?) ids of commands in vs
> menus.
>
> Any suggestion?
>
> TIA
>
> --
> Layos
date: Tue, 5 Aug 2008 15:47:52 -0600   author:   Arnie

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us