??
字號:
Attribute VB_Name = "組件自注冊自銷毀"
Public regBlRegistFailed As Boolean
' this Function regist Ezlib.dll and FileMapBuilder.dll Com-DLLs
' Succeed, returns 0
' Failed , returns 1
Public Function procRegistCOMs() As Long
procRegistComDll "EZlib.Ezlib1", "EZlib.dll"
procRegistComDll "FileMapBuilder.FileMapPro", "FileMapBuilder.dll"
On Error GoTo ErrHandler
'Set obj = CreateObject("EZlib.EZlib1")
Set obj = CreateObject("FileMapBuilder.FileMapPro")
procRegistCOMs = 0
Exit Function
ErrHandler:
procRegistCOMs = 1
End Function
' this Function Unregist Ezlib.dll and FileMapBuilder.dll Com-DLLs
' Succeed, returns 0
' Failed, returns 1
Public Function procUnregistCOMS() As Long
procUnregistComDll "Ezlib.Ezlib1", "Ezlib.dll"
procUnregistComDll "FileMapBuilder.FileMapPro", "FileMapBuilder.dll"
On Error GoTo ErrHandler
Set obj = CreateObject("Ezlib.Ezlib1")
Set obj = CreateObject("FileMapBuilder.FileMapPro")
procUnregistCOMS = 1
Exit Function
ErrHandler:
procUnregistCOMS = 0
End Function
' Reigist Specified COM which has ProgId as param1 strProgId
' and FileName as param2 strDllFileName
Private Function procRegistComDll(strProgId As String, strDllFileName As String)
Dim strShell As String
' if error occur means the COM haven't been Rigisted
On Error GoTo NeedRegist
Set obj = CreateObject(Trim(strProgId))
Exit Function
NeedRegist:
' Regist the COM
strShell = Environ("systemRoot") + "\System32\regsvr32 /s " + Chr(34) + App.Path + "\" + _
Trim(strDllFileName) + Chr(34)
Call Shell(strShell)
End Function
' Unreigist Specified COM which has ProgId as param1 strProgId
' and FileName as param2 strDllFileName
Private Function procUnregistComDll(strProgId As String, strDllFileName As String)
Dim strShell As String
' if error occur means the COM needn't Unregisting
On Error GoTo NeedntRegist
Set obj = CreateObject(Trim(strProgId))
' Unregist the COM
strShell = Environ("systemRoot") + "\System32\regsvr32 /s /u " + Chr(34) + App.Path + "\" + _
Trim(strDllFileName) + Chr(34)
Call Shell(strShell)
NeedntRegist:
End Function
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -