Loadlibrary / Declaring dll function at runtime
My software uses a Can serial card. I need to support three different types of card (PCMCIA, PCI, USB) each of these have there own dll. The dll's all contain the same function / function names.
At the moment I have to get all the users to rename their dll file to 'cancard.dll' then I am using:
VB Code:
Declare Function CANPC_reset_board Lib "cancard.dll" Alias "_CANPC_reset_board@0" () As Long
to delcare the function(s).
I want to get away from forcing the user to rename their DLL's and automatically detect their dll and delcare it at runtime.
I briefly looked at LoadLibrary, but it appears you need to use CallWindowProc to call the function. I still want to use the same syntax as before e.g
VB Code:
dim err_code as long
err_code = CANPC_reset_board
Any ideas?
Cheers