Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Macro to Clear the Immediate Window - Visual Studio 2005

RSS
Modified on Thu, Jul 02, 2009, 1:56 PM by Administrator Categorized as Visual Studio and Developer Tools
In Visual Studio 2005, it can be useful to clear the Immediate Window at the start of a program execution. This can be accomplished by first implementing the following code into the code for your Visual Studio macros. Then, by setting a breakpoint on the first line of the program and specifying When Hit for the breakpoint to Run a macro > Macros.MyMacros.ImmediateWindow.ClearAndActivate, the Immediate Window will be cleared every time you start the program.

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics

Public Module ImmediateWindow

    'GUID for the Immediate Window
    Public Const GUID As String = "{ECB7191A-597B-41F5-9843-03A4CF275DDE}"

    Public Sub Clear()

        Dim win As Window = DTE.ActiveWindow
        DTE.Windows.Item(GUID).Activate()
        DTE.ExecuteCommand("Edit.SelectAll")
        DTE.ExecuteCommand("Edit.ClearAll")
        win.Activate()

    End Sub

    Public Sub ClearAndActivate()

        DTE.Windows.Item(GUID).Activate()
        DTE.ExecuteCommand("Edit.SelectAll")
        DTE.ExecuteCommand("Edit.ClearAll")

    End Sub

    Public Sub Activate()

        DTE.Windows.Item(GUID).Activate()

    End Sub

End Module 

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.