Reputation: 13
I have an MFC GUI application project in Visual studio 2010.
I want to get communication with a mini circuit signal generator device. The device has a DLL file named mcl_gen64.dll
.
I want to use functions of that DLL in my code but I don't have any idea how to do this: Any idea please?
Upvotes: 0
Views: 798
Reputation: 1917
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)
The dll should exist in your executable folder. Or if you debug it in VS, in your project's folder as well. Mind the "__stdcall" notation when defining the function pointer.
Upvotes: 1