我在 Visual Studio 2010 中有一个 MFC GUI 应用程序项目。
我想与微型电路信号发生器设备进行通信。该设备有一个名为 .dll 的 DLL 文件mcl_gen64.dll
。
我想在我的代码中使用那个 DLL 的函数,但我不知道如何做到这一点:知道吗?
https://ww2.minicircuits.com/softwaredownload/Quick%20Setup%20Guide.pdf
typedef int (__stdcall *ConnectByAddressPtr)(short Addr);
ConnectByAddressPtr ConnectByAddress = NULL;
HMODULE hLib = LoadLibrary(_T("mcl_gen64.dll"));
if (hLib)
ConnectByAddress =
(ConnectByAddressPtr)GetProcAddress(hLib,"ConnectByAddress");
if (ConnectByAddress)
ConnectByAddress(0x01)
dll 应该存在于您的可执行文件夹中。或者,如果您在 VS 中调试它,则也在您的项目文件夹中。在定义函数指针时注意“__stdcall”符号。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句