MyException - 我的异常网
当前位置:我的异常网» VB » "关于VB生成标准DLL文件"做出来的link.ex

"关于VB生成标准DLL文件"做出来的link.exe有有关问题,请帮忙看看。

www.MyException.Cn  网友分享于:2013-12-30  浏览:32次
"关于VB生成标准DLL文件"做出来的link.exe有问题,请帮忙看看。。。
大家好 我在“关于VB生成标准DLL文件 ”那里找到关于怎么用vb6生成标准DLL文件的方法,我按照方法上说得做了,但是发现方法上做出来的新link.exe总会出现一下错误,我不知道怎么解决,请问有人有头绪吗?

Run-time error '-2147319779 (8002801d)' :
Automation error
Library not registered

===============================原文===============================
工程NewLinker.vbp

模块文件NewLinker.bas

Option Explicit

Public Sub Main()
  Dim SpecialLink As Boolean, fCPL As Boolean, fResource As Boolean
  Dim intPos As Integer
  Dim strCmd As String
  Dim strPath As String
  Dim strFileContents As String
  Dim strDefFile As String, strResFile As String
  Dim oFS As New Scripting.FileSystemObject
  Dim fld As Folder
  Dim fil As File
  Dim ts As TextStream, tsDef As TextStream

  strCmd = Command
   
  Set ts = oFS.CreateTextFile(App.Path & "/lnklog.txt")
   
  ts.WriteLine "Beginning execution at " & Date & " " & Time()
  ts.WriteBlankLines 1
  ts.WriteLine "Command line arguments to LINK call:"
  ts.WriteBlankLines 1
  ts.WriteLine " " & strCmd
  ts.WriteBlankLines 2
   
  ' Determine if .DEF file exists
  '
  ' Extract path from first .obj argument
  intPos = InStr(1, strCmd, ".OBJ", vbTextCompare)
  strPath = Mid(strCmd, 2, intPos + 2)
  intPos = InStrRev(strPath, "/")
  strPath = Left(strPath, intPos - 1)
  ' Open folder
  Set fld = oFS.GetFolder(strPath)
   
  ' Get files in folder
  For Each fil In fld.Files
  If UCase(oFS.GetExtensionName(fil)) = "DEF" Then
  strDefFile = fil
  SpecialLink = True
  End If
  If UCase(oFS.GetExtensionName(fil)) = "RES" Then
  strResFile = fil
  fResource = True
  End If
  If SpecialLink And fResource Then Exit For
  Next
   
  ' Change command line arguments if flag set
  If SpecialLink Then
  ' Determine contents of .DEF file
  Set tsDef = oFS.OpenTextFile(strDefFile)
  strFileContents = tsDef.ReadAll
  If InStr(1, strFileContents, "CplApplet", vbTextCompare) > 0 Then
  fCPL = True
  End If
   
  ' Add module definition before /DLL switch
  intPos = InStr(1, strCmd, "/DLL", vbTextCompare)
  If intPos > 0 Then
  strCmd = Left(strCmd, intPos - 1) & _
  " /DEF:" & Chr(34) & strDefFile & Chr(34) & " " & _
  Mid(strCmd, intPos)
  End If
  ' Include .RES file if one exists
  If fResource Then
  intPos = InStr(1, strCmd, "/ENTRY", vbTextCompare)
  strCmd = Left(strCmd, intPos - 1) & Chr(34) & strResFile & _
  Chr(34) & " " & Mid(strCmd, intPos)
  End If
   
  ' If Control Panel applet, change "DLL" extension to "CPL"
  If fCPL Then
  strCmd = Replace(strCmd, ".dll", ".cpl", 1, , vbTextCompare)
  End If
   
  ' Write linker options to output file
  ts.WriteLine "Command line arguments after modification:"
  ts.WriteBlankLines 1

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有