Re: Dynamic DLL

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Lars-Eric Gisslén (nowhere_at_inter.net)
Date: 03/25/04


Date: Thu, 25 Mar 2004 18:54:04 +0100

Holm,

>From what I know, VB/VBA can not call a function by the function pointer.

I have a solution where I load the DLL dynamically (using
LoadLibrary/FreeLibrary) but I have the DLL declarations in the VBA code
like
Declare Function ......

The DLL resides on a server on the network (the client can be in another
city) and then call the functions declared in the Declare... statements. The
only thing I make sure is that I can succesfully load the DLL before I call
any Func/Sub in the module where the DLL functions are declared (the Declare
statements are declared as Private).

Has never failed for me. The DLL is loaded from the server about one million
times per year so I might say it works.

-- 
Regards,
Lars-Eric Gisslén
"Holm Kirschgens" <kirschgens@advis.de> skrev i meddelandet
news:c3utf0$2ah06j$1@ID-13880.news.uni-berlin.de...
> Dear group,
>
> I want to call some functions in a DLL, which has to be loaded
> dynamically. So I declare the functions LoadLibrary, GetProcAddress, and
> FreeLibrary from kernel32.dll. I can load the DLL and I can get the
> address of the function. But how can I call it, i.e. how do I handle the
> function parameters? Somewhere I found some examples where the
> CallWindowProc is uses, but how do I pass the parameters to it?
>
> Thanks in advance,
> Holm Kirschgens.
>


Relevant Pages

  • Re: Unsigned 32 bit
    ... This helper dll has the base adress 0x02400000. ... Its equivalent VB declare is ... Dim MyVar As Long, AdressOfMyVar1 As Long, AdressOfMyVar2 As Long ... Both project internal adresses are inside the jump table VB has build. ...
    (microsoft.public.vb.general.discussion)
  • Re: Unsigned 32 bit
    ... > For this helper dll I wrote a typelib in IDL called ukVBHLB.tlb. ... Its equivalent VB declare is ... > Both project internal adresses are inside the jump table VB has build. ...
    (microsoft.public.vb.general.discussion)
  • Re: Loadlibrary returns err.lastdellerror 127
    ... the resulting .exe I load all the dependant DLL's first (there are ... Assuming this is a 'regular' Dll and not an ActiveX Dll. ... you do NOT need to 'load' all the dependant Dlls. ... Actually the declare statements are there as well. ...
    (microsoft.public.vb.general.discussion)
  • Re: Converting VB6 Structures to .NET
    ... This dll was written by a third party ... I will try ByRef. ... I am using a number of "Declare Function" statments to access the functions ... Public Structure zFuheader ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Exported function mangaled name
    ... that header file; it must be declared as __declspec ... You have to declare the function the same way in your .cpp file as in ... #define LIBSPEC __declspec ... See my essay on The Ultimate DLL Header File on my MVP Tips site. ...
    (microsoft.public.vc.mfc)