1、解决方案:m_hFH463CommI句柄改成全局变量。在stdafx.h文件中定义全局变量extern HANDLE g_hFH463CommI; //串口句柄stdafx.cppHANDLE g_hFH463CommI; //串口句柄然后给全局变量赋值g_hFH463CommI=m_hFH463CommI;WriteFile(g_hFH463CommI, ch, sizeof(ch), &dwactlen, NULL) ;
1、解决方案:m_hFH463CommI句柄改成全局变量。在stdafx.h文件中定义全局变量extern HANDLE g_hFH463CommI; //串口句柄stdafx.cppHANDLE g_hFH463CommI; //串口句柄然后给全局变量赋值g_hFH463CommI=m_hFH463CommI;WriteFile(g_hFH463CommI, ch, sizeof(ch), &dwactlen, NULL) ;