![SystemBase Portbase-3010 Скачать руководство пользователя страница 104](http://html.mh-extra.com/html/systembase/portbase-3010/portbase-3010_user-manual_1423462104.webp)
Portbase User Guide
SetCommState(hComm, &dcb);
// Sets a timer for transmission.
SetTimer(1, 3000, NULL);
// Sets a timer for reception.
SetTimer(2, 1, NULL);
}
void CExample1Dlg::OnTimer(UINT nIDEvent)
{
CEdit * pEdt = (CEdit *)GetDlgItem(IDC_edtWINDOW);
char WriteData[30] = "This is LoopBack Data !";
DWORD Writed;
if(nIDEvent == 1) { // In case data is output to the port.
// Outputs data to the port.
WriteFile(hComm, WriteData, strlen(WriteData), &Writed, NULL);
}
if(nIDEvent == 2) { // In case data is inputted to the port.
COMSTAT c;
char rbuff[1000];
DWORD nBytesRead = 0, Error;
// Clears an error & obtains the length of data to be read.
ClearCommError(hComm, &Error, &c);
if(c.cbInQue) {
ReadFile(hComm, rbuff, c.cbInQue, &nBytesRead, NULL);
// Outputs data to the edit box.
rbuff[nBytesRead] = 0;
pEdt->ReplaceSel(rbuff);
}
}
}
104
Содержание Portbase-3010
Страница 1: ......
Страница 61: ...Portbase User Guide 4 Click Next 5 Choose destination location and click Next 61 ...
Страница 90: ...Portbase User Guide Log Window 90 ...