有人用过笙泉的MA101桥接器吗?

2019-07-15 16:35发布

  1. HINSTANCE HWND_DLL;
  2. typedef struct  _MW_BridgeMini
  3. {
  4.     DWORD VID;           // Need to match user device's "Vendor ID".
  5.     DWORD PID;           // Need to match user device's "Product ID".
  6.     DWORD ReadtimeOut;          // Specifies the read data time-out interval, in milliseconds.
  7.     DWORD WriteTimeOut;          // Specifies the write data time-out interval, in milliseconds.   
  8.     HANDLE Handle;                      // Do not modify this value, reserved for DLL

  9. } MW_BridgeMini;
  10. MW_BridgeMini BridgeObj;

  11. CString m_strVid;
  12. CString m_strPid;

  13. DWORD dwResult = 0;

  14. DWORD index = 1;

  15. typedef DWORD (*MyFun)(MW_BridgeMini ,DWORD);
  16. MyFun MyFun_1;


  17. m_strVid = "0E6A";
  18. m_strPid = "0103";

  19. HWND_DLL = LoadLibrary("BridgeMini.dll");

  20. BridgeObj.VID = HexStrToDW(m_strVid); //字符串转换为整型
  21. BridgeObj.PID = HexStrToDW(m_strPid); //字符串转换为整型
  22. BridgeObj.ReadTimeOut = 0xfffffff; // for demo purpose 默认
  23. BridgeObj.WriteTimeOut = 0xfffffff;// for demo purpose 默认
  24. BridgeObj.Handle = HWND_DLL;

  25. MyFun_1 = (MyFun)GetProcAddress(HWND_DLL,"MA101_ConnectBridge");

  26. dwResult = MyFun_1(BridgeObj,index);

  27. TRACE("connect return : %d ", dwResult);

  28. FreeLibrary(HWND_DLL);
复制代码上述源码哪里出问题了,请大家指正。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。