LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Class not registered DavidH Excel Discussion (Misc queries) 0 April 16th 06 10:40 PM
i cannot register the key while i registered it before and it wor. annie New Users to Excel 1 November 8th 05 02:50 PM
(R) = Registered Trademark?? J Streger Excel Discussion (Misc queries) 2 September 29th 05 06:18 PM
MsComm32.ocx not registered Eric Excel Programming 1 May 28th 04 10:52 PM
Add-In - Component not correctly registered pietje bell Excel Programming 0 January 29th 04 02:39 PM


All times are GMT +1. The time now is 06:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"