Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check if DLL is registered
Is there any way to check whether or not a particular DLL is registered?
The problem I have is that some of my .xla's require certain network DLL's to be registered, but I do not want to have to re-register these DLL's every time i load the .xla, since registering a DLL takes about 0.1 second each on my 3 Ghz comp. I thought perhaps instead I could much more quickly check to see if a particular DLL is registered, and then if not, register it. Is this possible? The code I use to register DLL's is below: Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long 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 CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Any, ByVal wParam As Any, ByVal lParam As Any) As Long Private Const ERROR_SUCCESS = &H0 Private Const ERROR_AHHHHHH = &HF Public Function RegisterServer(hwnd As Long, DllServerPath As String, bRegister As Boolean) As Boolean On Error Resume Next Dim lb As Long, pa As Long lb = LoadLibrary(DllServerPath) If bRegister Then pa = GetProcAddress(lb, "DllRegisterServer") Else pa = GetProcAddress(lb, "DllUnregisterServer") End If If CallWindowProc(pa, hwnd, ByVal 0&, ByVal 0&, ByVal 0&) = ERROR_SUCCESS Then RegisterServer = True Else RegisterServer = False End If FreeLibrary lb End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Class not registered | Excel Discussion (Misc queries) | |||
i cannot register the key while i registered it before and it wor. | New Users to Excel | |||
(R) = Registered Trademark?? | Excel Discussion (Misc queries) | |||
MsComm32.ocx not registered | Excel Programming | |||
Add-In - Component not correctly registered | Excel Programming |