I want to use Visual C++ to create a custom program for a linear actuator control board. I want to use the functions and control values specified in LAC advanced config on pages 6-10.
I have the following code to load the dll file.
#include <windows.h> // This is a windows header file. The functions I mentioned above are declared here
#include <mpusbapi.h> // This is the header file supplied. It declares the function prototypes that are defined in the DLL
int main(int argc, char* argv)
{
// Try to load the library
HMODULE mpbusDLL = NULL;
mpbusDLL = LoadLibrary(L"mpusbapi.dll");
if (mpbusDLL != NULL) {
// If the library could be loaded, then load the functions using GetProcAddress()
// Load the function 'MPUSBOpen' from the DLL
MPUSBOpen = (HANDLE(*)(DWORD, PCHAR, PCHAR, DWORD, DWORD)) GetProcAddress(mpbusDLL, "_MPUSBOpen");
}
}
However, the LAC drivers comes with a mpusbapi.dll but no mpusbapi.h file. Is it possible that the mpusbapi.h file is within the .dll file? And if so, how can I utilize it.
As of now I get fatal error C1083: Cannot open include file: 'mpusbapi.h': No such file or directory when I try to build the program.
EDIT 1 & 2:
Found the mpusbapi.h file! If anyone out there needs it…
The header file (mpusbapi.h) is probably delivered with a SDK.
If there is no SDK, you should get at least an API documentation and manually declare the functions to be imported from the DLL.
How did you know the MPUSBOpen function requires the DWORD, PCHAR and so on parameters and returns a HANDLE?