1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
                CollapseNode(subitem)
                subitem.UIHierarchyItems.Expanded = False
            End If
        Next
 
    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.")
            Return
        End If
 
        ' Get the top node (the name of the solution)
        Dim UIHSolutionRootNode As UIHierarchyItem
        UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
 
        CollapseNode(UIHSolutionRootNode)
 
        ' 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.
        UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
 
    End Sub
 
    ' 이 하위 루틴은 실행 중인 프로세스에 연결합니다.
    Sub AttachToNotepad()
        Dim ProcessName = "Notepad.exe"
        ProcessAttach(ProcessName)
    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
                proc.Attach()
                attached = True
                Exit For
            End If
        Next
 
        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

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

덧글을 달아 주세요