한국어
팁/강좌/노하우
 

두가지 형태의 출력 방법

AddString(); 무조건 맨 마지막에 항목을 추가하는 함수

InsertString(); 인덱스를 지정해서 원하는 위치에 항목을 추가한다.

/*
cstrMsg.Format(_T("MsgType:%d_"), SafSpdPacket->MsgType);
cstrSMsg.Format(_T("SubMsgType:%d_"), SafSpdPacket->SubMsgType);
cstrCycle.Format(_T("CycCnt:%d_"), SafSpdPacket->CycCnt);
cstrChDist.Format(_T("SpdCngDist:%d_"), SafSpdPacket->SpdCngDist);
cstrCurSafe.Format(_T("CurSafSpd:%d_"), SafSpdPacket->CurSafSpd);
cstrNxtSafe.Format(_T("NxtSafSpd:%d_"), SafSpdPacket->NxtSafSpd);
cstrCRType.Format(_T("CurRdType:%d_"), SafSpdPacket->CurRdType);
cstrNRType.Format(_T("NxtRdType:%d_"), SafSpdPacket->NxtRdType);
//cstrRes.Format(_T("Reserved: %d"), SafSpdPacket->Reserved); */

FirstLine.Format(_T("MsgType:[%d],SubMsgType:[%d],CycCnt:[%d],SpdCngDist:[%d]"),
(unsigned int)SafSpdPacket->MsgType,
(unsigned int)SafSpdPacket->SubMsgType,
(unsigned int)SafSpdPacket->CycCnt,
(unsigned int)SafSpdPacket->SpdCngDist); 

SecondLine.Format(_T("CurSafSpd:[%d],NxtSafSpd:[%d],CurRdType:[%d],NxtRdType:[%d]"),
(unsigned int)SafSpdPacket->CurSafSpd,
(unsigned int)SafSpdPacket->NxtSafSpd,
(unsigned int)SafSpdPacket->CurRdType,
(unsigned int)SafSpdPacket->NxtRdType);

//cstrInfo = cstrMsg + cstrSMsg + cstrCycle + cstrChDist; 
//cstrInfo2 = cstrCurSafe + cstrNxtSafe + cstrCRType + cstrNRType;

m_MessageList = (CListBox*)GetDlgItem(IDC_LIST2);

//m_MessageList->AddString(cstrInfo);
//m_MessageList->AddString(cstrInfo2);
m_MessageList->InsertString(0,FirstLine);
m_MessageList->InsertString(1,SecondLine);