void Actions_Refresh (void) { size_t nItems = 0; TCHAR szText[ cchRESOURCE ]; HWND hList; if ((hList = GetDlgItem (l.hAction, IDC_ACTION_LIST)) != NULL) { LPARAM lpOld = FL_StartChange (hList, TRUE); if (l.pActionList) { for (size_t ii = 0; ii < l.pActionList->cEntries; ++ii) { LPTSTR pszDesc; if ((pszDesc = GetActionDescription (&l.pActionList->aEntries[ ii ].Action)) != NULL) { SYSTEMTIME st; TicksToElapsedTime (&st, GetTickCount() - l.pActionList->aEntries[ ii ].Action.csecActive); FormatElapsed (szText, TEXT("%s"), &st); FASTLISTADDITEM flai; memset (&flai, 0x00, sizeof(flai)); flai.hParent = NULL; flai.iFirstImage = IMAGE_NOIMAGE; flai.iSecondImage = IMAGE_NOIMAGE; flai.pszText = pszDesc; flai.lParam = (LPARAM)ii; flai.dwFlags = FLIF_DISALLOW_SELECT; HLISTITEM hItem; if ((hItem = FastList_AddItem (hList, &flai)) != NULL) FastList_SetItemText (hList, hItem, 1, szText); ++nItems; FreeString (pszDesc); } } } FL_EndChange (hList, lpOld); } if (nItems == 0) GetString (szText, IDS_ACTION_DESC_NONE); else if (nItems == 1) GetString (szText, IDS_ACTION_DESC_ONE); else // (nItems >= 2) GetString (szText, IDS_ACTION_DESC_MULT); SetDlgItemText (l.hAction, IDC_ACTION_DESC, szText); }
void VirtualListCtrlFT::OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult) { LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR; LVITEM* pItem= &(pDispInfo->item); int index=pItem->iItem; // Valid text buffer? if (pItem->mask & LVIF_TEXT) { switch(pItem->iSubItem) { case SUB_REMOTE_IP: { unsigned int ip4=(v_data[index].m_remote_ip>>24)&0xFF; unsigned int ip3=(v_data[index].m_remote_ip>>16)&0xFF; unsigned int ip2=(v_data[index].m_remote_ip>>8)&0xFF; unsigned int ip1=(v_data[index].m_remote_ip>>0)&0xFF; sprintf(pItem->pszText,"%u.%u.%u.%u",ip1,ip2,ip3,ip4); break; } case SUB_MODULE: { _itoa(v_data[index].m_mod,pItem->pszText,10); break; } case SUB_SOCKET: { _itoa(v_data[index].m_sock,pItem->pszText,10); break; } case SUB_FILENAME: { strcpy(pItem->pszText,v_data[index].m_filename.c_str()); break; } case SUB_RANGE: { sprintf(pItem->pszText,"%s : %s",FormatSize(v_data[index].m_start).c_str(),FormatSize(v_data[index].m_end).c_str()); break; } case SUB_TOTAL_SIZE: { sprintf(pItem->pszText,"%s",FormatSize(v_data[index].m_total_size).c_str()); break; } case SUB_SENT: { sprintf(pItem->pszText,"%s / %s",FormatSize(v_data[index].m_num_sent).c_str(),FormatSize(v_data[index].m_end-v_data[index].m_start).c_str()); break; } case SUB_ELAPSED: { strcpy(pItem->pszText,FormatElapsed(v_data[index].m_time_elapsed).c_str()); break; } } } // Valid Image? if(pItem->mask & LVIF_IMAGE) { pItem->iImage=-1; } // Indent? if(pItem->mask & LVIF_INDENT) { pItem->iIndent=0; // always set the indent to 0 } // if(pItem->mask & LVIF_PARAM) { pItem->lParam=0; // always set the lParam to 0, since I don't know what it's for. Maybe it's the data. } // Always set the state to 0. because I don't know what else to do right now. if(pItem->mask & LVIF_STATE) { pItem->state=0; } *pResult = 0; }