1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| void CSnifferDlg::OnNMCustomdrawList1(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLVCUSTOMDRAW pNMCD = (LPNMLVCUSTOMDRAW)pNMHDR; *pResult = 0;
if (CDDS_PREPAINT == pNMCD->nmcd.dwDrawStage) *pResult = CDRF_NOTIFYITEMDRAW; else if(CDDS_ITEMPREPAINT == pNMCD->nmcd.dwDrawStage) { POSITION pos = this->m_localDataList.FindIndex(pNMCD->nmcd.dwItemSpec); struct data_packet * localData = (struct data_packet *)this->m_localDataList.GetAt(pos); char buffer[10]; memset(buffer, 0, sizeof(buffer)); strcpy(buffer, localData->type); COLORREF crText; if (!strcmp(buffer, "ARP")) crText = RGB(226, 238, 227); if (!strcmp(buffer, "IPv4")) crText = RGB(255, 182, 193); if (!strcmp(buffer, "IPv6")) crText = RGB(111, 224, 254); if(!strcmp(buffer, "UDP")) crText = RGB(194, 195, 252); if(!strcmp(buffer, "TCP")) crText = RGB(230, 230, 230); if(!strcmp(buffer, "ICMPv4")) crText = RGB(49, 164, 238); if(!strcmp(buffer, "ICMPv6")) crText = RGB(189, 254, 76); if (!strcmp(buffer, "HTTP")) crText = RGB(238, 232, 180);
pNMCD->clrTextBk = crText; *pResult = CDRF_DODEFAULT; } }
|