absolute path to relative path in a function

J

javiernews

Hi,

Is is possible to call the following function with a relative o partial path
??

Look here:
"C:\TempAes\Aes.dll"

THIS IT WORKS GOOD:
Private Declare Function AesEncKey Lib "C:\TempAes\Aes.dll" Alias
"_aes_enc_key@12" (K As KeyBlk, ByVal N As Long, C As AESctx) As Integer


I tryed with something like this but I had got an ERROR

THIS I GOT ERROR:
Private Declare Function AesEncKey Lib funPath Alias "_aes_enc_key@12" (K
As KeyBlk, ByVal N As Long, C As AESctx) As Integer "<<< Error


Function funPath() As String
rem relative path
funPath = Application.CurrentProject.Path & "\" & "Aes.dll"
End Function

thank you !

Javier
 
D

Douglas J. Steele

No, it's not possible to put a variable in a Declare statement.

However, if you've got the dll in the same folder as the MDB, try using the
ChDir statement (and possibly the ChDrv statement if necessary) to make sure
that the current directoy is the same as where the file is, and then simply
use

Private Declare Function AesEncKey Lib "Aes.dll" Alias
"_aes_enc_key@12" (K As KeyBlk, ByVal N As Long, C As AESctx) As Integer
 
Top