如何编写c++dll函数来获取com端口Reading
How to write c++ dll function to get com port Reading
所有我都是c++的新手,我试图从c中的函数读取COM端口++下面是代码的说明,有人能帮我完成吗?函数应该获取注释中的值,请帮助我感谢
int ComPortReading( short, wchar_t * Data[], wchar_t **Output, SIZE_T *OutputSize )
{
int result = 1;
if( Data[0] )
{
*OutputSize = 50;
*Output = (wchar_t *) CoTaskMemAlloc(*OutputSize);
if( *Output )
{
wchar_t *EndPtr;
double v11 = wcstod(Data[0], &EndPtr); // Port Name
double v12 = wcstod(Data[1], &EndPtr); // Baud Rate
double v13 = wcstod(Data[2], &EndPtr); // Data Bits
double v14 = wcstod(Data[3], &EndPtr); // Stop Bits
double v15 = wcstod(Data[4], &EndPtr); // Parity
// Need to write code here to read COM port
// Com port settings can be taken from the above v11 - v15 values
swprintf(*Output, L"%.10lf", v11);
result = 0;
}
}
return result;
}
我建议使用一个库,它封装了硬东西。例如,CodeProject上的这个库或Boost.Asio.的实现
相关文章:
- 如何等待 COM 端口上的数据
- 如何通过按回车键退出通过COM端口读取条形码?
- COM 端口C++读取0xFF
- 可视C++ 设置串行 COM 端口时出现问题
- 带虚拟COM端口的USB串行设备-如果使用带USB路径的CreateFile(),则ReadFile()读取零字节
- USB串行虚拟COM端口:读取不工作,但写入工作
- 通过COM端口与ModEEG通信
- 连接到Windows 7上10的COM端口时,无效的手柄错误
- 在Java,C 或C#中模拟COM端口
- C 或 C++ 中的 COM 端口库
- 识别与 Windows USB 虚拟 COM 端口的连接事件
- 使用tserial.cpp驱动程序读取COM端口时的延迟
- 如何编写c++dll函数来获取com端口Reading
- 无法在COM端口上正确使用windows.h ReadFile.WriteFile似乎工作正常
- 如果我得到CE_FRAME错误,com端口通信有什么问题
- 读取 COM 端口数据C++
- 在C++中打开一个数字大于9的COM端口
- 读取后 COM 端口无法写入
- Win32上FILE_FLAG_OVERLAPPED的COM端口通信永远挂起
- 等待COM端口上的数据