VC++6.0注释快捷键设置

简介:

在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,并打开增加以下内容:

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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 + /",进行注释或取消注释。

 本文转自二郎三郎博客园博客,原文链接:http://www.cnblogs.com/haore147/p/3919544.html,如需转载请自行联系原作者

相关文章
|
16天前
|
编译器 开发工具 C++
Dev-C++详细安装教程及中文设置(附带安装包链接)
Dev-C++详细安装教程及中文设置(附带安装包链接)
41 0
|
1月前
|
自然语言处理 算法 Java
C/C++ 程序员编程规范之注释
C/C++ 程序员编程规范之注释
43 1
|
3月前
|
数据采集 API 开发工具
Baumer工业相机堡盟工业相机如何通过NEOAPI SDK设置软件触发模式(C++)
Baumer工业相机堡盟工业相机如何通过NEOAPI SDK设置软件触发模式(C++)
31 0
|
3月前
|
编解码 监控 开发工具
Baumer工业相机堡盟工业相机如何通过NEOAPI SDK设置相机的图像剪切(ROI)功能(C++)
Baumer工业相机堡盟工业相机如何通过NEOAPI SDK设置相机的图像剪切(ROI)功能(C++)
29 1
|
3月前
|
存储 数据管理 开发工具
Baumer工业相机堡盟工业相机如何通过NEOAPI SDK设置相机本身的数据保存(CustomData)功能(C++)
Baumer工业相机堡盟工业相机如何通过NEOAPI SDK设置相机本身的数据保存(CustomData)功能(C++)
46 0
|
3月前
|
存储 数据采集 数据处理
Baumer工业相机堡盟工业相机如何通过BGAPISDK设置相机的Bufferlist序列(C++)
Baumer工业相机堡盟工业相机如何通过BGAPISDK设置相机的Bufferlist序列(C++)
36 0
|
5月前
|
存储 Cloud Native Linux
C++Qt表格控件一些常用的设置封装
C++Qt表格控件一些常用的设置封装
|
3月前
|
编解码 监控 开发工具
Baumer工业相机堡盟工业相机如何通过BGAPI SDK设置相机的图像剪切(ROI)功能(C++)
Baumer工业相机堡盟工业相机如何通过BGAPI SDK设置相机的图像剪切(ROI)功能(C++)
34 0
|
17天前
|
存储 程序员 编译器
C++注释、变量、常量、关键字、标识符、输入输出
C++注释、变量、常量、关键字、标识符、输入输出
|
30天前
|
Linux API C++
【C++ 线程包裹类设计】跨平台C++线程包装类:属性设置与平台差异的全面探讨
【C++ 线程包裹类设计】跨平台C++线程包装类:属性设置与平台差异的全面探讨
51 2