Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Function registerDll(dllname As String) As Boolean
Dim hLib As Long
Dim hProc As Long
hLib = LoadLibrary(dllname)
If hLib = 0 Then
registerDll = False
Exit Function
End If
hProc = GetProcAddress(hLib, "DllRegisterServer")
If hProc = 0 Then
FreeLibrary hLib
registerDll = False
Exit Function
End If
CallWindowProc hProc, 0, 0, 0, 0
FreeLibrary hLib
registerDll = True
End Function
|