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
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