Welcome to MSDN Blogs Sign in | Join | Help

How to run a command using IVSLaunchPad?

Please remember that the code below comes with a Disclaimer 

 In a VS package

/// <summary>

/// This function is the callback used to execute a command when the a menu item is clicked.

/// See the Initialize method to see how the menu item is associated to this function using

/// the OleMenuCommandService service and the MenuCommand class.

/// </summary>

private void MenuItemCallback(object sender, EventArgs e)

{

IVsLaunchPad lp = GetService(typeof(SVsLaunchPad)) as IVsLaunchPad;

IVsOutputWindow ow = GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;

Guid owguid = new Guid();

int exCd = ow.CreatePane(ref owguid,"temp pane", 1, 1);

IVsOutputWindowPane owp;

ow.GetPane(ref owguid, out owp);

uint exitcode = 0;

lp.ExecCommand(null, "c:\\temp\\myTempApp.exe", "c:\\temp\\",

(uint)Microsoft.VisualStudio.Shell.Interop._LAUNCHPAD_FLAGS.LPF_PipeStdoutToOutputWindow,

owp, (uint)Microsoft.VisualStudio.Shell.Interop.VSTASKCATEGORY.CAT_USER,

0,

"", null, out exitcode, null);

 

}

Posted by tufane | 0 Comments

Getting Macro project properties

I was trying to get properties of a Macro project and I came up with the following. Please remember that the code below comes with a Disclaimer

Hope it helps

Tufan

Sub GetMacroPrjProperties()

Dim projectPath As String = "Macros\MyMacros" 'Get the Macro Explorer window and activate it
Dim macrosWin As Window = DTE.Windows.Item(Constants.vsWindowKindMacroExplorer) macrosWin.Activate() 'Get the UIHierarchy for Macro Explorer
Dim macroExpl As UIHierarchy = macrosWin.Object

Dim macroProjectHierarchy As UIHierarchyItem = macroExpl.GetItem(projectPath)
'Get the Properties window and activate it
Dim propWin As EnvDTE.Window = DTE.Windows.Item(Constants.vsWindowKindProperties)
propWin.Activate() 'Select the Macro Project which will also set the SelectionContainer for Properties window

macroProjectHierarchy.Select(vsUISelectionType.vsUISelectionTypeSelect) 'DTE.SelectedItems.SelectionContainer.Item(1) should get you a VSMacroHierarchyLib.IProjectProps
Debug.Print(DTE.SelectedItems.SelectionContainer.Item(1).Name)
Debug.Print(DTE.SelectedItems.SelectionContainer.Item(1).StorageFormat)

End Sub

Posted by tufane | 0 Comments

The required disclaimer

These postings are provided "AS IS" with no warranties, and confers no rights. The content of this site are my own personal opinions and do not represent my employer's view in anyway. In addition, my thoughts and opinions often change, and as a weblog is intended to provide a semi-permanent point in time snapshot you should not consider out of date posts to reflect my current thoughts and opinions.
Posted by tufane | 1 Comments

About Me

I am a member of the Visual Studio Extensibility Team. I am mainly responsible for the quality of the Macros, Project Policy, Build Object Model and Text Editor Object Model.

I will try to share my experience on these areas using this blog space.

Posted by tufane | 0 Comments
 
Page view tracker