📄
字号:
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -