Visual C++指示设备

发布于 2025-01-07 17:30:13 字数 1239 浏览 0 评论 0原文

我想使用 Visual C++ 为线性执行器控制板创建自定义程序。我想使用第 6-10 页的 LAC 高级配置 中指定的功能和控制值。

我有以下代码来加载 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 文件内?如果是这样,我该如何利用它。

截至目前,当我尝试构建程序时,我收到致命错误 C1083:无法打开包含文件:'mpusbapi.h':没有这样的文件或目录

编辑 1 & 2:

找到 mpusbapi .h 文件!如果有人需要的话...

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情绪 2025-01-14 17:30:13

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

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文