自动将文件中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
[VB.NET程序]VB6 中 使用Winsock穿越各种代理的实现(TCP协议) [VB.NET程序]VB6 中使用错误处理对于速度的影响 [VB.NET程序]VB6 中 善用 ByRef 提升速度
|