| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 457 人关注过本帖
标题:VS.NET 2003中添加函数头和文件头的宏
只看楼主 加入收藏
hanyou
Rank: 1
等 级:新手上路
威 望:1
帖 子:105
专家分:0
注 册:2005-4-2
收藏
 问题点数:0 回复次数:0 
VS.NET 2003中添加函数头和文件头的宏

Imports EnvDTE
Imports System.Diagnostics

Public Module InterPreter

REM 提取函数名称
Function GetFuncName(szStr as String)
Dim szTmp, szFunc
Dim ulPos, ulLen
Dim szTmpStr

szTmpStr = Trim(szStr)
szFunc = 0

If Trim(szTmpStr) <> "" Then
ulPos = InStr(Trim(szTmpStr), "(")
szTmp = Trim(Left(szTmpStr, ulPos - 1))
ulLen = Len(szTmp)
ulPos = InStrRev(szTmp, " ")
szFunc = Right(szTmp, ulLen - ulPos)
Else
szFunc = ""
End If
GetFuncName = szFunc
End Function


REM 输出函数头
Sub FunctionHeader()
Dim szTmp, szStr
szTmp = DTE.ActiveDocument.Selection.Text

szStr = "" _
& "/******************************************************************************* " & vbCrLf & "" _
& "* Function name : " & GetFuncName(szTmp) & vbCrLf & "" _
& "* Description : " & vbCrLf & "" _
& "* Arguments : " & vbCrLf & "" _
& "* Return value : " & vbCrLf & "" _
& "* Author : HCJ " & vbCrLf & "" _
& "* Date     : " & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & vbCrLf & "" _
& "*******************************************************************************/ " & vbCrLf

DTE.ActiveDocument.Selection.StartOfLine()
DTE.ActiveDocument.Selection.Text = szStr
End Sub

REM 输出文件头
Sub FileHeader()
DTE.ActiveDocument.Selection.StartOfDocument()
DTE.ActiveDocument.Selection.Text = "" _
& "/********************************************************************************** " & vbCrLf & "" _
& "* File name : " & DTE.ActiveDocument.Name & vbCrLf & "" _
& "* Description : " & vbCrLf & "" _
& "* Author : HCJ " & vbCrLf & "" _
& "* Copyright (c) 2005-" & Year(Now) & vbCrLf & "" _
& "* Version : 0.1 " & vbCrLf & "" _
& "* Date : " & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & vbCrLf & "" _
& "**********************************************************************************/ " & vbCrLf

End Sub

REM 输出类头
Sub ClassHeader()
DTE.ActiveDocument.Selection.Text = "" _
& "/******************************************************************************* " & vbCrLf & "" _
& "* Class name : " & vbCrLf & "" _
& "* Description : " & vbCrLf & "" _
& "* Interface : " & vbCrLf & "" _
& "* Call : " & vbCrLf & "" _
& "* Author : HCJ " & vbCrLf & "" _
& "********************************************************************************/ " & vbCrLf
End Sub

End Module

搜索更多相关主题的帖子: 文件 NET 
2006-04-27 13:25
快速回复:VS.NET 2003中添加函数头和文件头的宏
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029918 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved