VC++6.0 快捷键添加

第一步:找到文件所在目录,鼠标右键VC++6.0点击打开文件所在的位置

第二步:在此电脑里找到E盘 -->VC6.0-->Microsoft Visual Studio-->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-->工具-->定制

 第四步:点击附加和宏文件选择comment.dsm(后缀名可有可无),

有的打开后可能没有comment这个选项,需要点击浏览搜索文件名comment.ent.txt 选择打开后就会出现comment.dsm选项

 

 第五步:点击键盘-->类别选择Macros

 第六步:单机选择CustomCommentOut-->按住Ctrl键和/键,最后点击分配

最后测试快捷键是可行的

 

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值