Dynamically declaring functions
Posted on 2003-02-20
I have a C Dll that contains a number of functions that I need to access from a VB component. I first declare the function like so:
Private Declare Function MyFunc Lib "MyDll" Alias "MyMethod" () As Long
which then allows me to call the function.
Each time a new function is created in the C Dll, I don't want to have to update the VB component to add in a corresponding "Private Declare Function.." statement. Is there a way I can dynamically do this?
Ideally, I'd like to be able to pass a DLL name and method name into the VB component, dynamically build up and run the "Private Declare.." statement and then call that function.