在vs中获得当前所有快捷键代码
ms-help://MS.MSDNQTR.v90.en/dv_vssettings/html/bbfc1243-fa27-45df-9c4b-6bca181132d6.htm
Sub GetAllCommands()
Dim getCommandsWithSCOnly As Boolean
Dim cmd As Command
Dim cmdCollection As Commands
Dim ow As OutputWindow = DTE.Windows.Item(Constants.vsWindowKindOutput).Object
Dim owp As OutputWindowPane
Dim exists As Boolean
Dim i As Integer
i = 1
exists = False
For Each owp In ow.OutputWindowPanes
If owp.Name = "Macro Output" Then
exists = True
Exit For
End If
i = i + 1
Next
If exists Then
owp = ow.OutputWindowPanes.Item(i)
Else
owp = ow.OutputWindowPanes.Add("Macro Output")
End If
owp.Clear()
' Output 1 line per command
For Each cmd In DTE.Commands
Dim binding As Object
Dim shortcuts As String
shortcuts = ""
For Each binding In cmd.Bindings
Dim b As String
Dim sArray() As String
b = binding
shortcuts = shortcuts + b + " "
Next
shortcuts = shortcuts.Trim()
If Not cmd.Name.Trim().Equals("") Then
owp.OutputString(cmd.Name + vbTab + shortcuts + vbCrLf)
Else
owp.OutputString(cmd.Guid.ToString() + ":" + cmd.ID.ToString() + vbTab + shortcuts + vbCrLf)
End If
Next
End Sub
Dim getCommandsWithSCOnly As Boolean
Dim cmd As Command
Dim cmdCollection As Commands
Dim ow As OutputWindow = DTE.Windows.Item(Constants.vsWindowKindOutput).Object
Dim owp As OutputWindowPane
Dim exists As Boolean
Dim i As Integer
i = 1
exists = False
For Each owp In ow.OutputWindowPanes
If owp.Name = "Macro Output" Then
exists = True
Exit For
End If
i = i + 1
Next
If exists Then
owp = ow.OutputWindowPanes.Item(i)
Else
owp = ow.OutputWindowPanes.Add("Macro Output")
End If
owp.Clear()
' Output 1 line per command
For Each cmd In DTE.Commands
Dim binding As Object
Dim shortcuts As String
shortcuts = ""
For Each binding In cmd.Bindings
Dim b As String
Dim sArray() As String
b = binding
shortcuts = shortcuts + b + " "
Next
shortcuts = shortcuts.Trim()
If Not cmd.Name.Trim().Equals("") Then
owp.OutputString(cmd.Name + vbTab + shortcuts + vbCrLf)
Else
owp.OutputString(cmd.Guid.ToString() + ":" + cmd.ID.ToString() + vbTab + shortcuts + vbCrLf)
End If
Next
End Sub
posted on 2010-12-22 16:14 Michael Peng 阅读(2640) 评论(0) 编辑 收藏 举报