2012-02-22 45 views
1

我想使用Visual C++为线性执行器控制板创建自定义程序。我想使用第6-10页上的LAC advanced config中指定的功能和控制值。Visual C++指导设备

我有以下代码来加载dll文件。

#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"); 

} 

}

然而,LAC驱动器带有一个mpusbapi.dll但没有mpusbapi.h文件。 mpusbapi.h文件是否可能在.dll文件中?如果是这样,我该如何利用它。

截至目前,当我尝试构建程序时,我得到fatal error C1083: Cannot open include file: 'mpusbapi.h': No such file or directory

EDIT 1 & 2:

找到了mpusbapi.h文件!如果有人需要它...

回答

0

头文件(mpusbapi.h)可能随SDK提供。 如果没有SDK,您至少应该得到一个API文档并手动声明要从DLL中导入的函数。 你是怎么知道MPUSBOpen函数需要DWORD,PCHAR等参数并返回HANDLE的?