you can use following approach:
Private Declare Function GetModuleHandle Lib "kernel32" Alias
"GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA"
(ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As
Long) As Long
a proc:
strDllPath="C:\CountUsersConnectedToDatabase.DLL"
hModule = GetModuleHandle(strDllPath)
If hModule = 0 Then
' need to load module into this process.
hModule = LoadLibrary(strDllPath & "irun.dll")
FreeLib = True
End If
call LDBUser_GetUsers (...)
If FreeLib Then Call FreeLibrary(hModule)
--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com
"Sven Daems" <(E-Mail Removed)> wrote in message
news:ED8A4119-B6E5-459F-9C4B-(E-Mail Removed)...
> Hy group
>
> I've a declaration of a function where I point to a .dll file. But I'd
> like
> to connect to the .dll file using a variable. See the example for more
> information.
>
> Now, I'm using:
> Declare Function LDBUser_GetUsers Lib
> "C:\CountUsersConnectedToDatabase.DLL" _
> (lpszUserBuffer() As String, ByVal lpszFilename As String, _
> ByVal nOptions As Long) As Integer
>
> But I'de like to put the "C:\CountUsersConnectedToDatabase.DLL" in a
> string
> because it will probably change of location. I allready tried the
> following
> but it didn't work.
>
> Declare Function LDBUser_GetUsers Lib strPathDLL_
> (lpszUserBuffer() As String, ByVal lpszFilename As String, _
> ByVal nOptions As Long) As Integer
>
> Does anybody has an idea?
>
> Thanxs