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

在eclipse等编辑工具中都有注释代码的快捷键,但是vc++6.0没有。

vc++是以VB为脚本来控制的,在网上找到了一个VB的脚本供大家使用。

 

工具/原料

  • VC++6.0

方法/步骤

  1. 打开VC的路径,根据自己安装的路径打开,如果找不到可以根据快捷键的属性进行查阅。

     

     

     

     
  2.  

    在目录里面创建一个空文本,将名字命名为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  

     
  3.  

    打开软件,找到“工具”选择“定制”。

     
  4.  

    在弹出的窗口中选择“附加项和宏文件”将“comment”复选框选中,然后单击“键盘”

     
  5.  

    选择“macros”

     
  6.  

    添加新的快捷键"Ctrl+/"或按照自己喜欢的快捷方式设置。

     
  7.  

    ok,下面是使用的情况,快捷键是可以使用的。

     
    END
 
 

出处:http://jingyan.baidu.com/article/2c8c281df4c7d40009252a4f.html

posted on   jack_Meng  阅读(3185)  评论(0编辑  收藏  举报

编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?

导航

< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5
点击右上角即可分享
微信分享提示

喜欢请打赏

扫描二维码打赏

支付宝打赏

主题色彩