I finally buckled down and poked into the innards of the VS.NET 2003 object model to duplicate the VC6 behavior of hiding the Build toolbar while debugging. The VBA macros are fired by Debugger events:
Imports EnvDTE
Imports System.Diagnostics
Imports Microsoft.Office.Core
Sub ActivateBuildToolbar(ByVal bShow As Boolean)
Dim bld As CommandBar, dbg As CommandBar
bld = DTE.CommandBars("Build")
dbg = DTE.CommandBars("Debug")
'always hide the visible one first, so the toolbars remain
'in the same position
If bShow Then
dbg.Visible = False
bld.Visible = True
Else
bld.Visible = False
dbg.Visible = True
End If
End Sub
<System.ContextStaticAttribute()> Public WithEvents DebuggerEvents _
As EnvDTE.DebuggerEvents
Private Sub DebuggerEvents_OnEnterDesignMode(ByVal Reason As EnvDTE.dbgEventReason) _
Handles DebuggerEvents.OnEnterDesignMode
ActivateBuildToolbar(True)
End Sub
Private Sub DebuggerEvents_OnEnterRunMode(ByVal Reason As EnvDTE.dbgEventReason) _
Handles DebuggerEvents.OnEnterRunMode
ActivateBuildToolbar(False)
End Sub
The Microsoft.Office.Core namespace is for declaring the CommandBars references. If for some reason this package is not included with VS.NET 2003 by default, omit the Imports statement and the associated references, calling code like this instead: DTE.CommandBars("Builds").Visible = False
It's been a while since I've had a good wrestling match with the IDE. I'm happy to say I came out on top this time , although not without some sleep deprivation. (The macro code itself wasn't hard to write, it was deciding if the code needed to be written in the first place that was laborious -- searching Google for "visual studio" 2003 toolbar layout returns 168,000 results!)