Usenet User,
In addition to all the other comments, you should be able to use LoadLibrary
& GetProcAddress. The "trick" is converting the IntPtr that GetProcAddress
returns to a Delegate.
Luckily In .NET 2.0 the System.Runtime.InterpoServices.Marshal class has a
GetDelegateForFunctionPointer method that will convert the IntPtr to a
Delegate.
http://msdn2.microsoft.com/en-us/library/zdx6dyyh(vs.80).aspx
For an example of how to use the above see:
http://www.pinvoke.net/default.aspx/kernel32/GetProcAddress.html
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
|I need to be able to call the same API function from VB, which will
| reside in different DLLs. While all of the functions have the same
| signature and name, DLL file names are not known at compile time.
| Therefore, my assumption that using Declare statement or DllImport
| attribute is NOT an option in such a case.
|
| I can use LoadLibrary() and GetProcAddress() from Kernel32 to get the
| addreses, but is there a way to actually call an API method by its
| address from VB? Or can anyone suggest anything else?
|
| TIA!