Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module SolutionExplorer

    Sub FindInSolution()
        Dim p = DTE.Properties("Environment", "ProjectsAndSolution").Item("TrackFileSelectionInExplorer")
        p.value = 1
        p.value = 0
    End Sub

    Sub CollapseNode(ByRef item As UIHierarchyItem)

        Dim subitem As UIHierarchyItem
        For Each subitem In item.UIHierarchyItems
            If (subitem.UIHierarchyItems.Expanded = True) Then
                subitem.UIHierarchyItems.Expanded = False
            End If

    End Sub

    Sub CollapseAll()

        ' Get the the Solution Explorer tree
        Dim UIHSolutionExplorer As UIHierarchy
        UIHSolutionExplorer = DTE.Windows.Item(EnvDTE.Constants.vsext_wk_SProjectWindow).Object()

        ' Check if there is any open solution
        If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
            ' MsgBox("Nothing to collapse. You must have an open solution.")
        End If

        ' Get the top node (the name of the solution)
        Dim UIHSolutionRootNode As UIHierarchyItem
        UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)


        ' Select the solution node, or else when you click on the solution window
        ' scrollbar, it will synchronize the open document with the tree and pop
        ' out the corresponding node which is probably not what you want.

    End Sub

    ' 이 하위 루틴은 실행 중인 프로세스에 연결합니다.
    Sub AttachToNotepad()
        Dim ProcessName = "Notepad.exe"
    End Sub

    ' 이 하위 루틴은 실행 중인 프로세스에 연결합니다.
    Sub ProcessAttach(ByVal ProcessName As String)

        Dim attached As Boolean = False
        Dim proc As EnvDTE.Process

        Dim ProcessNameSize = ProcessName.Length

        For Each proc In DTE.Debugger.LocalProcesses
            If (Right(proc.Name, ProcessNameSize) = ProcessName) Then
                attached = True
                Exit For
            End If

        If attached = False Then
            MsgBox(ProcessName & " is not running")
        End If

    End Sub

End Module
2008/09/18 20:04 2008/09/18 20:04

글 걸기 주소 : 이 글에는 트랙백을 보낼 수 없습니다

덧글을 달아 주세요