VC++6.0注释快捷键设置

news/2024/5/17 17:39:13 标签: vc6.0, udp, tcp, 网络, 编程


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 + /",进行注释或取消注释。




http://www.niftyadmin.cn/n/1685493.html

相关文章

HashMap原理jdk7和jdk8的区别

文章目录一、hashMap的jdk1.7和jdk1.8区别1、实现方式&#xff1a;2、新节点插入到链表是的插入顺序不同3、jdk8的hash算法有所简化扩容机制有所优化其他区别节点表示关于jdk7HashMap的一些细节关于jdk8HashMap的一些细节关于HashMap的一些其他细节一、hashMap的jdk1.7和jdk1.8…

怎么用VC6.0建立控制台程序

如何用VC6.0创建控制台程序呢。VC6.0是微软经典的编程开发环境&#xff0c;界面友好、宜于操作&#xff0c;是很多人开始学习C、C的首选开发环境。今天就和大家分享一下&#xff0c;怎样使用VC6.0建立简单的Win32控制台应用程序。^_^ 工具/原料 VC6.0开发环境计算机 方法/步骤…

Wireshark抓包系列教程之二:HTTP协议分析

本教程参考&#xff1a; A Top-Down Approach, 6th ed 一书中 Wireshark_HTTP_v6.1 进行协议分析实验&#xff0c;点击从 官网 免费下载。 实验一&#xff1a;基本的 HTTP GET/Response 操作 &#xff08;1&#xff09;实验步骤&#xff1a; ①打开浏览器&#xff1b; ②开启 W…

c++ 实现链队列数据结构

建立头文件LinkQueue.h #ifndef LinkQueue_h #define LinkQueue_htemplate <class DataType> //使用结构体定义结点 struct Node{DataType data;Node<DataType> *next; //指向下一个结点的指针 };template <class DataType> class LinkQueue{ public:LinkQu…

VC网络编程实战视频教程

图书&#xff1a;《Visual C 网络编程案例实战》 相关视频教程&#xff0c;见下面网址&#xff0c;非常详细&#xff0c;值得学习。 VisualC网络编程案例实战01&#xff1a;Visual C网络编程 http://v.ku6.com/show/HeYGLUly4n2feYVxDGTreg...html?st1_9_2_0&nr1 Visual…

c++ 实现邻接表有向图结构

建立头文件 #ifndef ALGraph_h #define ALGraph_hconst int MaxSize 20;struct ArcNode{ //邻接结点int adjvex;ArcNode *next;};template <class DataType> struct VertexNode{ //头结点DataType vertex;ArcNode *firstedge; };template <class DataType> cla…

java中new和反射的区别

区别如下&#xff1a; 1&#xff1a;首先new出来的对象我们无法访问其中的私有属性&#xff0c;但是通过反射出来的对象我们可以通过setAccessible()方法来访问其中的私有属性。 2&#xff1a;在使用new创建一个对象实例的时候必须知道类名&#xff0c;但是通过反射创建对象有时…

Winsock的初始化

首先是调用 WSAStartup() 来加载合适的 Winsock Dll版本 其中两个参数 WORD wVersionRequested 加载库的版本 LPWSADATA lpWSAData 关于版本信息的结构体 typedef struct WSAData {WORD(_16) wVersion; //winsocket的版本号//Windows XP 的版本是2.2WORD …