vc6.0注释功能的脚本快捷键设置代码
生活随笔
收集整理的這篇文章主要介紹了
vc6.0注释功能的脚本快捷键设置代码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
找到vc6.0的安裝路徑,vc6.0的默認安裝路徑是C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Macros。在Macros目錄里面創建一個空文本,將如下代碼添加到文本中去,將名字命名為comment.dsm。然后安裝下圖方法添加工具進去
在文件里面添加一下代碼:
Sub CustomCommentOut() 'DESCRIPTION: 注釋/取消注釋宏,可處理VB和C++、Java注釋Dim winset win = ActiveWindowIf win.type <> "Text" ThenMsgBox "This macro can only be run when a text editor window is active."ElseTypeOfFile = 3If TypeOfFile > 0 And TypeOfFile < 6 ThenIf TypeOfFile > 3 ThenCommentType = "'" ' VB注釋CommentWidth = 1ElseCommentType = "//" ' C++、java 注釋CommentWidth = 2End IfStartLine = ActiveDocument.Selection.TopLineEndLine = ActiveDocument.Selection.BottomLineIf EndLine < StartLine ThenTemp = StartLineStartLine = EndLineEndLine = TempEnd If' 單行If EndLine = StartLine ThenActiveDocument.Selection.StartOfLine dsFirstColumnActiveDocument.Selection.CharRight dsExtend, CommentWidthIf ActiveDocument.Selection = CommentType ThenActiveDocument.Selection.DeleteElseActiveDocument.Selection.StartOfLine dsFirstTextActiveDocument.Selection.CharRight dsExtend, CommentWidthIf ActiveDocument.Selection = CommentType ThenActiveDocument.Selection.CharRight dsExtendActiveDocument.Selection.DeleteElseActiveDocument.Selection.StartOfLine dsFirstTextActiveDocument.Selection = CommentType + vbTab + _ActiveDocument.SelectionEnd IfEnd If' 多行ElseFor i = StartLine To EndLineActiveDocument.Selection.GoToLine iCommentLoc = dsFirstColumnActiveDocument.Selection.StartOfLine CommentLocActiveDocument.Selection.CharRight dsExtend, CommentWidthIf ActiveDocument.Selection = CommentType ThenActiveDocument.Selection.DeleteElseActiveDocument.Selection.StartOfLine CommentLocActiveDocument.Selection = CommentType + _ActiveDocument.SelectionEnd IfNextEnd IfElseMsgBox("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 IfEnd If End Sub此時打開VC++6.0窗口,以下步驟:
1.打開菜單欄"Tools" -> “Customize” 打開了"Customize"對話框。
4.在代碼中,只需要選中代碼或者在光標所在行,執行快捷鍵"Ctrl + /",進行注釋或取消注釋。
總結
以上是生活随笔為你收集整理的vc6.0注释功能的脚本快捷键设置代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于数据集 使用PutCollect后m
- 下一篇: C/C++使用openssl进行摘要和加