VB语言

本类阅读TOP10

·Visual Basic 安装程序的制作!!
·VB中使用EXCEL输出
·一个简单的MP3播放器
·VB程序实现WindowsXP效果的界面!!
·VB打造超酷个性化菜单(六)
·透明位图
·平铺与拉伸MDI窗口的背景图 ~!~
·对《VB程序实现WindowsXP效果的界面》一文的补遗
·从Windows资源管理器中拖动文件
·VB打造超酷个性化菜单(一)

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
VB6 自动编译组件

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

自动将文件中vbp提取,编译为dll,将如下存为.vbs 即可

'---------------------------------------------------------------------------------------
' Module    : VB compiler
' DateTime  : 03-5-30 15:45
' Author    : Hardy He
' Purpose   : VB6 dll 自动编译工具
'---------------------------------------------------------------------------------------
' sVBPath : VB6 运行目录, sOutpath: 输出dll 目录, sSourcePath: VB源文件目录(包括子文件夹)

Dim sVBPath, sOutpath, sSourcePath
sVBPath = "D:\Program Files\Microsoft Visual Studio\VB98\"
sOutpath = "E:\719\Com\"
sSourcePath = "E:\719\"

Call SearchVbp(sSourcePath)
call DelTempFiles (sOutpath)

'//遍历目录得到vbp 工程文件并编译
Function SearchVbp(sPath)

   Dim fso, f, f1, fc, s, ff, ff1
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(sPath)
   Set fc = f.Files
   For Each f1 In fc
      If LCase(GetFileExtName(f1.Name)) = "vbp" Then
        MakeDll (f1.Path)       
      End If
   Next
   Set ff = f.Subfolders
   For Each ff1 In ff
        SearchVbp (ff1.Path)
   Next
  
End Function

'// 编译
Function MakeDll(sVBP)
    Dim oShell
    Set oShell = WScript.CreateObject("WSCript.shell")
    'msgbox """" & sVBPath & "vb6"" /m """ & sVBP & """ /outdir """ & sOutpath & """"
    oShell.run """" & sVBPath & "vb6"" /m """ & sVBP & """ /outdir """ & sOutpath & """"
    Set oShell = Nothing
End Function

'//删除临时文件
Function DelTempFiles(sPath)
    Dim oShell
    Set oShell = WScript.CreateObject("WSCript.shell")
    'msgbox "del /q/f " & sOutpath & "*.lib"
    oShell.run "cmd /c del /q/f " & sPath & "*.lib"
    oShell.run " cmd /c del /q/f " & sPath & "*.obj"
    oShell.run " cmd /c del /q/f " & sPath & "*.exp"
    oShell.run " cmd /c del /q/f " & sPath & "*.asp"
    Set oShell = Nothing
End Function

'//得到扩展名
Function GetFileExtName(sFileName)
    Dim ipos, ilen
    ipos = InStr(sFileName, ".")
    ilen = Len(sFileName)
    GetFileExtName = Right(sFileName, ilen - ipos)
End Function




相关文章

相关软件