Can a variable be used when declaring an API call ?

M

Mike Iacovou

Hi all

When declaring some API calls, is it possible to use a variable for the
"path" ? I have a standalone DLL that would be present in the directory the
worksheet / document is opened in that won't be registered on the system
locally... its functions can be accessed by pointing to the DLL - but I have
only even seen the path to the DLL hardcoded...

Private Declare Function FunctionName Lib "path" Alias "alias" (ByVal N As
Long) As Integer

TIA

Mike
 
J

Jim Rech

Have you tested whether you actually need a path? I'm pretty sure that the
current path is checked. If so just the dll's name would suffice.
 
M

Mike Iacovou

thanks jim

using the declaration with the DLL in the same folder fails with a "not
found" error... I guess it expects either a registered library or an absolute
path...
 
N

NickHK

First you need to confirm if this is an ActiveX DLL or a standard Windows
DLL.
The former:
- Needs registering
- You access it with by create an instance of its exposed classes

The latter:
- Does not need registering
- You call functions with the Declare statement similar to that you have
shown.

As for the error, it may be because one/some files that this DLL requires
are missing. Get a copy of Dependency Walker to check.

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top