📄 test.cpp
字号:
// Test.cpp: implementation of the CTest class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "comport.h"
#include "Test.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CTest::CTest()
{
m_testbuffer = "";
}
CTest::~CTest()
{
}
BOOL CTest::settestbuffer(CString str)
{
m_testbuffer = str;
return TRUE;
}
CString CTest::gettestbuffer()
{
return m_testbuffer;
}
char* CTest::sendCom(char *buf)
{
return buf;
}
BOOL CTest::test(char *inputcommand, CHAR* outputchar, int time)
{
CTime starttime, endtime;
BOOL find = FALSE;
starttime = CTime::GetCurrentTime();
endtime = starttime;
// CComPortDlg* pDlg = static_cast<CComPortDlg*>(this->GetParent());
// test_ComPort->SendCom(inputcommand,strlen(inputcommand));
while(endtime < (starttime + time))
{
Sleep(1000);
if(m_testbuffer.Find(outputchar,0)!=-1)
{
find = TRUE;
break;
}
}
if (find == TRUE)
return TRUE;
else
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -