MFC工控项目实例之十六输入信号验证
承接专栏《MFC工控项目实例之十五定时刷新PC6325A模拟量输入》
验证选定的输入信号实时状态
在BoardTest.cpp文件中添加代码
void CBoardTest::OnButton2()
{
// TODO: Add your control notification handler code here
isThreadBegin = true; //运行线程执行
pThread = AfxBeginThread(My_TheradFunc,(LPVOID)this);
CString tempStr,tempStr1;
int read;
GetPrivateProfileString("输入信号","信号2",NULL,tempStr.GetBuffer(20),20,strFilePath);
read=_ttoi(tempStr);
if (tempStr=="-1")
{
SetDlgItemText(IDC_STATIC99,"输入信号2是 0");
}
else
{
tempStr1.Format("输入信号2是 %d ", b[read]);
SetDlgItemText(IDC_STATIC99, tempStr1);
}
}
运行程序