VC++6.0注释快捷键设置和显示代码行号
来源:互联网 发布:淘宝上的艾滋试纸 编辑:程序博客网 时间:2024/04/30 02:11
在Qt Creator,eclipse等编辑器中,都默认有注释代码的快捷键:Ctrl + /。
注释快捷键在程序编程当中的作用相当明显,提高了编程效率。我在网上找到了一个在VC++6.0工具中添加注释快捷键的方法,VC++6.0是以VB为脚本来配置的。
首先,找到VC++6.0的安装路径,假设在:D:\Program Files (x86)\Microsoft Visual Studio 6.0,那么进入到Common\MSDev98\Macros目录下,全路径为:D:\Program Files (x86)\Microsoft Visual Studio 6.0\Common\MSDev98\Macros。
在该目录新建一个文本文件,并重命名为:comment.dsm,并打开增加以下内容:
Sub CustomCommentOut()'DESCRIPTION: 注释/取消注释宏,可处理VB和C++、Java注释<span style="white-space:pre"></span>Dim win<span style="white-space:pre"></span>set win = ActiveWindow<span style="white-space:pre"></span>If win.type <> "Text" Then<span style="white-space:pre"></span> MsgBox "This macro can only be run when a text editor window is active."<span style="white-space:pre"></span>Else<span style="white-space:pre"></span>TypeOfFile = 3<span style="white-space:pre"></span>If TypeOfFile > 0 And TypeOfFile < 6 Then<span style="white-space:pre"></span>If TypeOfFile > 3 Then<span style="white-space:pre"></span>CommentType = "'"<span style="white-space:pre"></span>' VB注释<span style="white-space:pre"></span>CommentWidth = 1<span style="white-space:pre"></span>Else<span style="white-space:pre"></span>CommentType = "//"<span style="white-space:pre"></span>' C++、java 注释<span style="white-space:pre"></span>CommentWidth = 2<span style="white-space:pre"></span>End If<span style="white-space:pre"></span> <span style="white-space:pre"></span>StartLine = ActiveDocument.Selection.TopLine<span style="white-space:pre"></span>EndLine = ActiveDocument.Selection.BottomLine<span style="white-space:pre"></span>If EndLine < StartLine Then<span style="white-space:pre"></span>Temp = StartLine<span style="white-space:pre"></span>StartLine = EndLine<span style="white-space:pre"></span>EndLine = Temp<span style="white-space:pre"></span>End If<span style="white-space:pre"></span>' 单行<span style="white-space:pre"></span>If EndLine = StartLine Then<span style="white-space:pre"></span>ActiveDocument.Selection.StartOfLine dsFirstColumn<span style="white-space:pre"></span>ActiveDocument.Selection.CharRight dsExtend, CommentWidth<span style="white-space:pre"></span>If ActiveDocument.Selection = CommentType Then<span style="white-space:pre"></span>ActiveDocument.Selection.Delete<span style="white-space:pre"></span>Else<span style="white-space:pre"></span>ActiveDocument.Selection.StartOfLine dsFirstText<span style="white-space:pre"></span>ActiveDocument.Selection.CharRight dsExtend, CommentWidth<span style="white-space:pre"></span>If ActiveDocument.Selection = CommentType Then<span style="white-space:pre"></span>ActiveDocument.Selection.CharRight dsExtend<span style="white-space:pre"></span>ActiveDocument.Selection.Delete<span style="white-space:pre"></span>Else<span style="white-space:pre"></span>ActiveDocument.Selection.StartOfLine dsFirstText<span style="white-space:pre"></span>ActiveDocument.Selection = CommentType + vbTab + _ ActiveDocument.Selection<span style="white-space:pre"></span>End If<span style="white-space:pre"></span>End If<span style="white-space:pre"></span>' 多行<span style="white-space:pre"></span>Else<span style="white-space:pre"></span>For i = StartLine To EndLine<span style="white-space:pre"></span>ActiveDocument.Selection.GoToLine i<span style="white-space:pre"></span>CommentLoc = dsFirstColumn<span style="white-space:pre"></span>ActiveDocument.Selection.StartOfLine CommentLoc<span style="white-space:pre"></span>ActiveDocument.Selection.CharRight dsExtend, CommentWidth<span style="white-space:pre"></span>If ActiveDocument.Selection = CommentType Then<span style="white-space:pre"></span>ActiveDocument.Selection.Delete<span style="white-space:pre"></span>Else<span style="white-space:pre"></span>ActiveDocument.Selection.StartOfLine CommentLoc<span style="white-space:pre"></span>ActiveDocument.Selection = CommentType + _ ActiveDocument.Selection<span style="white-space:pre"></span>End If<span style="white-space:pre"></span>Next<span style="white-space:pre"></span>End If<span style="white-space:pre"></span>Else<span style="white-space:pre"></span>MsgBox("Unable to comment out the highlighted text" + vbLf + _<span style="white-space:pre"></span>"because the file type was unrecognized." + vbLf + _<span style="white-space:pre"></span>"If the file has not yet been saved, " + vbLf + _<span style="white-space:pre"></span>"please save it and try again.")<span style="white-space:pre"></span>End If<span style="white-space:pre"></span>End IfEnd Sub
此时打开VC++6.0窗口,以下步骤:
1.打开菜单栏"Tools" -> "Customize" 打开了"Customize"对话框。
2.
3.
4.在代码中,只需要选中代码或者在光标所在行,执行快捷键"Ctrl + /",进行注释或取消注释。
VC6.0是一款比较稳定的功能强大的IDE,目前也有很多人在使用。但美中不足的是它不能像其他IDE那样显示行号。
这里需要用到一个插件VC6LineNumberAddin,下载地址:http://files.cnblogs.com/emanlee/VC6LineNumberAddin.rar(这是EmamLee上传的,感谢)。
使用步骤:
1.将文件中的VC6LineNumberAddin.dll拷贝到目录C:\Program Files\Microsoft Visual Studio\Common\MSDev98\AddIns;
2.打开vc6,菜单栏:Tools -> customize -> Add-ins and Macro Files
3.注册,双击VC6LineNumberAddin.reg进行注册。如果不进行注册也可以使用,不过最多只能显示500行
- VC++6.0注释快捷键设置和显示代码行号
- VC++6.0显示代码行号
- VC++6.0显示代码行号
- VC++6.0注释快捷键设置
- VC++6.0注释快捷键设置
- VC++6.0注释快捷键设置
- VC++6.0注释快捷键设置
- VC++6.0注释快捷键设置
- VC++6.0注释快捷键设置
- VC++6.0注释快捷键设置
- VC++6.0 注释 快捷键 的设置
- VC++6.0 显示行号
- vc++6.0显示行号
- VC++6.0 显示行号
- vc++6.0显示行号
- PHPStorm显示代码行号设置
- phpStorm设置显示代码行号
- phpStorm设置显示代码行号
- VPN
- BT 协议调用流程
- How to Disassemble/Assemble Galaxy S4 i9500 for Screen/Parts Repair!
- java中filter的用法
- php进一法取整、四舍五入取整、忽略小数等的取整数方法大全
- VC++6.0注释快捷键设置和显示代码行号
- 想念清秋萧瑟
- 从客户端 中检测到有潜在危险的 Request.Form 值。
- MFC中的 Document / View 结构的使用 <转载+自己总结,MFC中的MVC>
- 一文讲清楚Windows Mobile和Wince(Windows Embedded CE)的字符集问题
- GnomeShell 发布新的外观【Relayout】
- 【ArcGIS 10.2新特性】GeoEvent Processor for Server常见问题
- Android屏幕分辨率,尺寸获取问题
- 10分钟学会使用qmake