在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.Add-ins and Macro Files(附加项和宏文件) 勾选上 comment(对应上面的comment.dsm)

3.Keyboard(键盘)选项按下图配置

4.在代码中,只需要选中代码或者在光标所在行,执行快捷键"Ctrl + /",进行注释或取消注释。

转载:VC++6.0注释快捷键设置,略有修改的更多相关文章

  1. VC++6.0注释快捷键设置

    在Qt Creator,eclipse等编辑器中,都默认有注释代码的快捷键:Ctrl + /. 注释快捷键在程序编程当中的作用相当明显,提高了编程效率.我在网上找到了一个在VC++6.0工具中添加注释 ...

  2. VC++6.0注释快捷键的添加使用

    在eclipse等编辑工具中都有注释代码的快捷键,但是vc++6.0没有. vc++是以VB为脚本来控制的,在网上找到了一个VB的脚本供大家使用.   工具/原料 VC++6.0 方法/步骤 打开VC ...

  3. Source Insight常用快捷键及注释快捷键设置

    转:http://blog.csdn.net/tlaff/article/details/6536610 在使用SI过程中,我根据自己的使用习惯修改了它的默认快捷键,并且在配置文件中添加了一些人性化功 ...

  4. IDEA模板注释及相关快捷键设置

    IDEA模板注释及相关快捷键设置 最近使用IDEA时发现自带的模板注释不怎么好用,因此自己根据网上的教程总结了适合自己的模板设置,可以一键生成类和方法的注释,废话不多说一起看看吧: 第9步的类模板注释 ...

  5. VC++6.0 下配置 pthread库2010年12月12日 星期日 13:14VC下的pthread多线程编程 转载

    VC++6.0 下配置 pthread库2010年12月12日 星期日 13:14VC下的pthread多线程编程     转载 #include <stdio.h>#include &l ...

  6. Wing IDE设置(自动补全&注释快捷键)

    自动补全(默认使用Tab键自动补全) 修改方法:edit  -> preferences -> Editor -> Auto-completion 把右边keys的地方,从tab改成 ...

  7. EditPlus设置html和js文件的注释快捷键

    EditPlus默认是可以通过快捷键注释html的,格式是 <!-- </label> <label>类型</label> <label> --& ...

  8. 【转载】 Eclipse注释模板设置详解

     Eclipse注释模板设置详解 网站推荐: 金丝燕网(主要内容是 Java 相关) 木秀林网(主要内容是消息队列)

  9. Hotkeys.js 2.0.2 发布,JS 网页快捷键设置,捕获键盘输入和输入的组合键快捷键,它没有依赖

    这是一个强健的 Javascript 库用于捕获键盘输入和输入的组合键,它没有依赖,压缩只有只有(~3kb),gzip:1.9k. 更新内容: 添加测试用例: 添加更多特殊键支持: 修复bug. __ ...

随机推荐

  1. mysql /tmp目录爆满问题的处理

    mysql /tmp目录爆满问题的处理 突然收到zabbix告警,说mysql服务器的/目录磁盘空间不足. 登录到服务器,看了下发现100GB的根目录,居然使用了差不多90GB.这台服务器上只跑了一个 ...

  2. 第四章 jQuery节点操作

    1.DOM操作分为三类:(1)DOM Core:任何一种支持DOM的编程语言都可以使用用它如:getElementById()(2)HTML-DOM:用于处理HTML文档,如document,form ...

  3. Java 动态代理详解

    package com.at221; //代理设计模式: interface ClothFactory{ void product(); } class NikeFactory implements ...

  4. Java IO--NIO(二)

    在我的上一篇文章JavaNIO详解(一)中介绍了关于标准输入输出NIO相关知识, 本篇将重点介绍基于网络编程NIO(异步IO). 异步IO 异步 I/O 是一种没有阻塞地读写数据的方法.通常,在代码进 ...

  5. liunx 常用命令学习笔记

    通过linux 命令pwd:显示当前所在的目录ls:显示当前目录下的文件cd:切换路径 cd..返回上一级路径mkdir:新建目录rmdir:删除目录 touch:新建文件rm:删除文件 gedit: ...

  6. Ubuntu16.04 appstreamcli错误

    解决方案:https://askubuntu.com/questions/774986/appstreamcli-hanging-with-100-cpu-usage-during-update 搬运 ...

  7. Python基础(六)_全局变量声明、可变参数、关键字参数

    1. global声明全局变量 #声明name这个变量为全局变量,只是写在函数里面 #写代码时,尽量不要用全局变量,会一直占用内存.       ------->{'name':'abc','s ...

  8. nodejs笔记之搭建服务器

    简单服务器搭建: 1.新建一个文件:app.js 2.加入实现服务器代码: const http = require("http"); http.createServer(func ...

  9. nginx与PHP配置

    一.安装依赖包 yum -y install  libxml2  libxml2-devel  openssl  openssl-devel  curl  curl-devel libjpeg  li ...

  10. Linux操作oracle——关闭、停止、重启

    基础命令: 在此之前,先介绍一下切换到oracle用户的命令 su - oracle (注意空格) 一.启动监听.启动数据库1.1启动监听1.切换到oracle用户下 2.启动监听: lsnrctl ...