|
发表于 2007-1-12 09:56:00
|
显示全部楼层
Public Declare Function GetWindowsDirectoryA Lib "kernel32" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long
' ************************************************************************************
'
' 函数说明: 加载DLL文件
'
' ************************************************************************************
Public Sub LoadDll()
On Error Resume Next
Dim WinPath As String * 255
Dim MeFile As String
Dim sysFile As String
Dim strPath As String
Dim i As Integer
Call GetWindowsDirectoryA(WinPath, Len(WinPath))
i = 1
While Asc(Mid(WinPath, i, 1)) > 40
i = i + 1
Wend
MeFile = Replace(Mid(WinPath, 1, i - 1) & "\system32\CADConverter.dll", "\\", "\")
sysFile = Replace(App.Path & "\CADConverter.dll", "\\", "\")
Call FileCopy(sysFile, MeFile)
strPath = "regsvr32 /s " & MeFile
Shell strPath, vbHide
End Sub
这是一个注册CADConverter.dll的程序,将其注册到系统的sysstem32目录下.
要想注册整个目录的下控件,利用Scripting.FileSystemObject对象,对一个目录下的文件遍历即可.有兴趣的自己做做吧. |
|