2012-02-22 31 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的?