TechnoTone
Well-known member
I have written a macro that will auto-collapse code windows on opening. I dont know whether anyone else would find this a useful as I do but Im posting it anyway.
To install it, open the Macros IDE, open MyMacros-EnvironmentEvents, and copy-paste this code into the EnvironmentEvents module.
*It was written for VS.NET 2003.
Code:
Dim myWindows As New Collection
Dim myThread As System.Threading.Thread
Private Sub WindowEvents_WindowCreated(ByVal Window As EnvDTE.Window) Handles WindowEvents.WindowCreated
Try
myWindows.Add(Window)
If myThread Is Nothing Then
myThread = New System.Threading.Thread(AddressOf CollapseToDefinition)
End If
If myThread.ThreadState = System.Threading.ThreadState.Unstarted Then myThread.Start()
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub CollapseToDefinition()
Dim myCount As Integer
Do
myCount = myWindows.Count
myThread.Sleep(100)
Loop Until myCount = myWindows.Count
Dim myWindow As Window
While myWindows.Count > 0
Try
myWindow = myWindows.Item(1)
myWindows.Remove(1)
myWindow.Activate()
DTE.ExecuteCommand("Edit.CollapsetoDefinitions")
Catch
End Try
End While
myThread = Nothing
End Sub
*It was written for VS.NET 2003.