function()
{
/*
被注释掉的代码 //可以注释掉
*/}一般是上面的方法,但是,当被注释掉的代码中有/*...*/比如:
function()
{
/*
.........
其它代码
........
/*
想注释掉的代码 //可是注释不掉
*/ .........
其它代码
........
*/}
那么就会有代码注释不掉,我记得我看过一种方法可以,就是忘了,哪位大哥知道,言一声,谢谢了
{
/*
被注释掉的代码 //可以注释掉
*/}一般是上面的方法,但是,当被注释掉的代码中有/*...*/比如:
function()
{
/*
.........
其它代码
........
/*
想注释掉的代码 //可是注释不掉
*/ .........
其它代码
........
*/}
那么就会有代码注释不掉,我记得我看过一种方法可以,就是忘了,哪位大哥知道,言一声,谢谢了
解决方案 »
- CComBox获得上一次选择项?
- error C2275 illegal use of this type as an expression
- 我要做一个解压缩的程序,点击菜单栏中的解压缩按钮,弹出压缩对话框,选择压缩的.zip文件,浏览文件夹,选择压缩后存放的路径.解压缩过程调用静态链接库.望大侠们帮忙
- ADO的GetChunk后VARIANT转换问题
- 请教!为什么我的 MSDN 的索引不可用
- 查找字符串时,如何忽略‘\0’?在线
- 高手快进。
- VB 写的OCX 如何事件驱动 在线等,马上结
- Win98/NT/2000系统下如何判断是静态IP还是动态IP,即Dhcp是否打开
- 请问编程如何创建一个拨号连接的快捷方式
- 机子无法启动,各位大虾帮帮忙!
- 请问Access中如何实现模糊查询?好像Like不能用?
#if 0
...
...
...
#endif
就可以了!!!
#if 0
不需要的代码
#endif
Function FileType (ByVal doc)
ext = doc.Name
FileType = 0
pos = Instr(ext, ".")
if pos > 0 then
Do While pos <> 1
ext = Mid(ext, pos, Len(ext) - pos + 1)
pos = Instr(ext, ".")
Loop
ext = LCase(ext)
end if
If ext = ".rc" Or ext = ".rc2" Then
FileType = 4
ElseIf doc.Language = dsCPP Then
FileType = 1
ElseIf doc.Language = dsJava Then
FileType = 2
ElseIf doc.Language = dsIDL Then
FileType = 3
ElseIf doc.Language = dsHTML_IE3 Or doc.Language = dsHTML_RFC1866 Then
FileType = 5
ElseIf doc.Language = dsVBSMacro Then '
FileType = 6
ElseIf ext = ".def" Then
FileType = 7
Else
FileType = 0
End If
End FunctionSub CommentOut ()
'DESCRIPTION: Comments out a selected block of text.
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 = FileType(ActiveDocument)
CommentType="//"
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 = CommentType + ActiveDocument.Selection Else
For i = StartLine To EndLine
ActiveDocument.Selection.GoToLine i
ActiveDocument.Selection.SelectLine
ActiveDocument.Selection = CommentType + _
ActiveDocument.Selection
Next
End If
End If
End SubSub CommentIn ()
'DESCRIPTION: Comments in a selected block of text.
Dim win
Dim temptxt
set win = ActiveWindow
if win.type <> "Text" Then
MsgBox "This macro can only be run when a text editor window is active."
else
StartLine = ActiveDocument.Selection.TopLine
EndLine = ActiveDocument.Selection.BottomLine
If EndLine < StartLine Then
Temp = StartLine
StartLine = EndLine
EndLine = Temp
End If If EndLine = StartLine Then
temptxt =Ltrim(ActiveDocument.Selection)
count=Len(temptxt)
if count>2 then
temp1=left(temptxt,2)
if temp1="//" then
ActiveDocument.Selection=Right(temptxt,count-2)
end if
end if
Else
For i = StartLine To EndLine
ActiveDocument.Selection.GoToLine i
ActiveDocument.Selection.SelectLine
temptxt =Ltrim(ActiveDocument.Selection)
count=Len(temptxt)
if count>2 then
temp1=left(temptxt,2)
if temp1="//" then
ActiveDocument.Selection=Right(temptxt,count-2)
end if
end if
Next
End If
end if
End Sub
格式有点乱,将就点吧:)
endif;)不过这样不直观,但是方便
{
/*
.........
其它代码
........
///*
想注释掉的代码 //可是注释不掉
//*/ .........
其它代码
........
*/}