VC6.0添加注释快捷键,类似Eclispe如此方便
2013-11-15 21:22
316 查看
作为一个java程序员,开发C++,首先唯一不习惯的就是IDE环境。当然,环境乃是身外之物,不可因此太依赖于此。但是在VC6.0中,最不舒服的就是,注释时,往往不自觉的使用CTRL+/或者CTRL+SHIFT+/,可惜VC6.0没有设置注释,所以往往手动设置,我那个天哦。
从网上发现很好的解决方案,嘻嘻,又可以与Eclispe一样喽……
以下为转载——转载地址:http://blog.csdn.net/gzshun/article/details/7782458
在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注释
Dim win
set win = ActiveWindow
If win.type <> "Text" Then
MsgBox "This macro can only be run when a text editor window is active."
Else
TypeOfFile = 3
If TypeOfFile > 0 And TypeOfFile < 6 Then
If TypeOfFile > 3 Then
CommentType = "'" ' VB注释
CommentWidth = 1
Else
CommentType = "//" ' C++、java 注释
CommentWidth = 2
End If
StartLine = ActiveDocument.Selection.TopLine
EndLine = ActiveDocument.Selection.BottomLine
If EndLine < StartLine Then
Temp = StartLine
StartLine = EndLine
EndLine = Temp
End If
' 单行
If EndLine = StartLine Then
ActiveDocument.Selection.StartOfLine dsFirstColumn
ActiveDocument.Selection.CharRight dsExtend, CommentWidth
If ActiveDocument.Selection = CommentType Then
ActiveDocument.Selection.Delete
Else
ActiveDocument.Selection.StartOfLine dsFirstText
ActiveDocument.Selection.CharRight dsExtend, CommentWidth
If ActiveDocument.Selection = CommentType Then
ActiveDocument.Selection.CharRight dsExtend
ActiveDocument.Selection.Delete
Else
ActiveDocument.Selection.StartOfLine dsFirstText
ActiveDocument.Selection = CommentType + vbTab + _
ActiveDocument.Selection
End If
End If
' 多行
Else
For i = StartLine To EndLine
ActiveDocument.Selection.GoToLine i
CommentLoc = dsFirstColumn
ActiveDocument.Selection.StartOfLine CommentLoc
ActiveDocument.Selection.CharRight dsExtend, CommentWidth
If ActiveDocument.Selection = CommentType Then
ActiveDocument.Selection.Delete
Else
ActiveDocument.Selection.StartOfLine CommentLoc
ActiveDocument.Selection = CommentType + _
ActiveDocument.Selection
End If
Next
End If
Else
MsgBox("Unable to comment out the highlighted text" + vbLf + _
"because the file type was unrecognized." + vbLf + _
"If the file has not yet been saved, " + vbLf + _
"please save it and try again.")
End If
End If
End Sub
此时打开VC++6.0窗口,以下步骤:
1.打开菜单栏"Tools" -> "Customize" 打开了"Customize"对话框。
2.
![](https://img-blog.csdn.net/20131115211943468?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaXFpemhlbmc=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
3.
![](https://img-blog.csdn.net/20131115212111734?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaXFpemhlbmc=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
4.在代码中,只需要选中代码或者在光标所在行,执行快捷键"Ctrl + /",进行注释或取消注释。
从网上发现很好的解决方案,嘻嘻,又可以与Eclispe一样喽……
以下为转载——转载地址:http://blog.csdn.net/gzshun/article/details/7782458
在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注释
Dim win
set win = ActiveWindow
If win.type <> "Text" Then
MsgBox "This macro can only be run when a text editor window is active."
Else
TypeOfFile = 3
If TypeOfFile > 0 And TypeOfFile < 6 Then
If TypeOfFile > 3 Then
CommentType = "'" ' VB注释
CommentWidth = 1
Else
CommentType = "//" ' C++、java 注释
CommentWidth = 2
End If
StartLine = ActiveDocument.Selection.TopLine
EndLine = ActiveDocument.Selection.BottomLine
If EndLine < StartLine Then
Temp = StartLine
StartLine = EndLine
EndLine = Temp
End If
' 单行
If EndLine = StartLine Then
ActiveDocument.Selection.StartOfLine dsFirstColumn
ActiveDocument.Selection.CharRight dsExtend, CommentWidth
If ActiveDocument.Selection = CommentType Then
ActiveDocument.Selection.Delete
Else
ActiveDocument.Selection.StartOfLine dsFirstText
ActiveDocument.Selection.CharRight dsExtend, CommentWidth
If ActiveDocument.Selection = CommentType Then
ActiveDocument.Selection.CharRight dsExtend
ActiveDocument.Selection.Delete
Else
ActiveDocument.Selection.StartOfLine dsFirstText
ActiveDocument.Selection = CommentType + vbTab + _
ActiveDocument.Selection
End If
End If
' 多行
Else
For i = StartLine To EndLine
ActiveDocument.Selection.GoToLine i
CommentLoc = dsFirstColumn
ActiveDocument.Selection.StartOfLine CommentLoc
ActiveDocument.Selection.CharRight dsExtend, CommentWidth
If ActiveDocument.Selection = CommentType Then
ActiveDocument.Selection.Delete
Else
ActiveDocument.Selection.StartOfLine CommentLoc
ActiveDocument.Selection = CommentType + _
ActiveDocument.Selection
End If
Next
End If
Else
MsgBox("Unable to comment out the highlighted text" + vbLf + _
"because the file type was unrecognized." + vbLf + _
"If the file has not yet been saved, " + vbLf + _
"please save it and try again.")
End If
End If
End Sub
此时打开VC++6.0窗口,以下步骤:
1.打开菜单栏"Tools" -> "Customize" 打开了"Customize"对话框。
2.
3.
4.在代码中,只需要选中代码或者在光标所在行,执行快捷键"Ctrl + /",进行注释或取消注释。
相关文章推荐
- VC6.0添加注释快捷键,类似Eclispe如此方便
- eclipse 中的注释 快捷键-添加/* */注释-Ctrl+Shift+/
- Eclipse中添加文档注释快捷键
- eclipse 快捷键大全,eclipse查找类,文件,添加注释
- 用VA快速添加注释+快捷键
- word快速添加注释快捷键
- Eclipse中添加文档注释快捷键
- Android---给方法自动添加带参数的注释的快捷键设置
- 关于Keil 的快速注释功能,并为其添加快捷键
- Eclipse 中添加文档注释快捷键
- Xcode之command+/快捷键添加注释不起作用
- Eclipse中添加文档注释快捷键
- eclipse 快捷键大全,eclipse查找类,文件,添加注释
- 用VA快速添加注释+快捷键
- zendstudio添加注释快捷键
- Eclipse和STS中添加文档注释快捷键
- 给你的webstorm添加快速生成注释得快捷键
- [转]VC 6.0 快捷键添加/取消注释
- Android Studio新建类头部注释和添加函数注释模板及快捷键
- VC6.0注释快捷键