I was getting tired of hitting the F10 every step to debug the programs. Are there any program can automate the visual studio to run each deb开发者_如何转开发ugging step in a consistent frequency? say, 3 seconds for each step?
Regards, Sam
You can easily do that with a simple script in Autohotkey.
Download it from here: http://www.autohotkey.com/
Install Autohotkey.
Run it.
Find the green "H" icon in the task bar (bottom right).
Right click the icon and select Edit script.
And copy paste this script below.
^!y:: InputBox, input1, How many F10 strokes you want?, , , 250, 100 InputBox, input2, How many seconds between each F10 stroke?, , , 250, 100 if ErrorLevel <> 0 { MsgBox, CANCEL was pressed. } else { loop, %input1% { Sleep, (input2 * 1000) Send {F10} } MsgBox, "Your F10 script has Ended" } return
Then reload (again by right clicking the green "H" icon in task bar).
Press Control+Alt+y to try out the above script.
Sitting there repeatedly hitting F10 can be annoying, but you probably just need to make more use of the inbuilt debugging features.
- set a breakpoint at a targetted location and hit F5 to run the program, it will stop when it hits the breakpoint
- use F11 to step in to a function
- use Shift-F11 to step out of a function
- use the breakpoints window (Debug->Windows->Breakpoints) to get a complete list of all the bp's and you can easily enable/disable any of them (or set any of their other options)
- use the Exceptions window (Debug->Exceptions) to select exceptions that you want to break on when they are first thrown
familiarize yourself with the options available to breakpoints (right-click on the bp itself to get these)
hit count: specify how many times code should go past the breakpoint before it stops
condition: super useful (i use it all the time), you can use almost any expression in there, including checking the value of inscope variables
when hit: you can run a macro when the breakpoint is hit
filter: to restrict which running thread can break on that breakpoint
精彩评论