pap*_*jam 20 c++ debugging visual-studio-2010 visual-studio
我想更改我的命令行参数,然后调试我的可执行文件.
使用默认的Visual Studio UI,这会带来几个曲折的鼠标和键盘操作:
项目...右键单击...配置属性...调试...命令参数... 键入args ... ENTER ... F5
有没有办法让这个常见操作像其他常见操作一样简单,例如,搜索所有文件的模式:
CNTL + SHIFT + F ... 类型搜索模式 ... ENTER
例如,有没有办法创建自定义编辑框以允许快速访问调试命令行参数?或者让键绑定弹出一个简单的"调试对话框",可以输入args并直接调试?例如
ALT + F5 ... 键入args ... ENTER
我正在使用C++和Visual Studio 2010 Express.谢谢!
osi*_*hra 11
扩展CLIArgsMadeEasy 2010/2012是一个很棒的小东西,它将项目的调试会话的命令行参数放在Visual Studio工具栏上的一个小文本框中,IMO,它比使用宏更简单,更乏味.
链接
http://visualstudiogallery.msdn.microsoft.com/8159cd7d-2c81-47f3-9794-a347ec1fba09?SRC=VSIDE
您只需在扩展管理器的搜索框中键入CLIArgsMadeEasy即可在库中快速找到它,这就是我如何安装它,如果您需要知道的话.希望这可以帮助!
下面的宏应该有帮助.打开"工具 - >宏 - >宏资源管理器",然后创建新模块,编辑它,并在下面复制粘贴代码.必需的命令是SetCommandArgsProperty.用户界面不好,但它有效(VS 2005,我希望这也适用于VS 2010).然后添加您喜欢的任何快捷方式来运行此宏.
以下是一些细节:
如果选择"确定",则更新属性
Sub SetCommandArgsProperty()
Dim newVal As Object
newVal = InputValue(GetCommandArgsPropertyValue())
If TypeOf newVal Is String Then
SetCommandArgsProperty(newVal)
End If
End Sub
Function InputValue(ByVal defaultText As String)
Dim frm As New System.Windows.Forms.Form
Dim btn As New System.Windows.Forms.Button
Dim edit As New System.Windows.Forms.TextBox
edit.Text = defaultText
edit.Width = 100
btn.Text = "OK"
btn.DialogResult = System.Windows.Forms.DialogResult.OK
frm.Text = "Input command line properties"
frm.Controls.Add(btn)
btn.Dock = System.Windows.Forms.DockStyle.Bottom
frm.Controls.Add(edit)
edit.Dock = System.Windows.Forms.DockStyle.Top
frm.Height = 80
frm.Width = 300
If frm.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Return edit.Text
End If
Return System.DBNull.Value
End Function
Function GetCommandArgsProperty() As EnvDTE.Property
Dim solution As Solution
Dim project As Project
Dim sb As SolutionBuild
Dim str As String
Dim cm As ConfigurationManager
Dim config As Configuration
Dim properties As Properties
Dim prop As EnvDTE.Property
solution = DTE.Solution
sb = solution.SolutionBuild
For Each str In sb.StartupProjects
project = solution.Item(str)
cm = project.ConfigurationManager
config = cm.ActiveConfiguration
properties = config.Properties
For Each prop In properties
If prop.Name = "CommandArguments" Then
Return prop
End If
Next
Next
End Function
Function GetCommandArgsPropertyValue()
Return GetCommandArgsProperty().Value
End Function
Sub SetCommandArgsProperty(ByVal value As String)
GetCommandArgsProperty().Value = value
End Sub
Run Code Online (Sandbox Code Playgroud)小智 5
至少在 Visual Studio 2012 中,您可以使用Alt+F7
快捷方式直接访问项目属性。
此外,打开的属性页通常会记住上次打开的项目,即Configuration Properties -> Debugging
。
归档时间: |
|
查看次数: |
21247 次 |
最近记录: |