void CPerformanceMonitorDlg::InsertList(const char *pszMachineName, double cpu, long mem, long network, long processMem, long processHandle)
{
char buffer[128];
LVITEM item;
int i = m_ServerListControl.GetItemCount();
m_ServerListControl.InsertItem(LVIF_TEXT, i, pszMachineName, 0, 0, i, NULL);
memset(&item, 0 ,sizeof(item));
item.iItem = i;
item.mask = LVIF_TEXT;
item.iSubItem = 1;
sprintf(buffer, "%.2lf", cpu);
item.pszText = buffer;
m_ServerListControl.SetItem(&item);
item.iSubItem = 2;
sprintf(buffer, "%ld", mem);
item.pszText = buffer;
m_ServerListControl.SetItem(&item);
item.iSubItem = 3;
sprintf(buffer, "%ld", network);
item.pszText = buffer;
m_ServerListControl.SetItem(&item);
item.iSubItem = 4;
sprintf(buffer, "%ld", processMem);
item.pszText = buffer;
m_ServerListControl.SetItem(&item);
item.iSubItem = 5;
sprintf(buffer, "%ld", processHandle);
item.pszText = buffer;
m_ServerListControl.SetItem(&item);
}
void CPerformanceMonitorDlg::UpdateList(int index, const char *pszMachineName, double cpu, long mem, long network, long processMem, long processHandle)
{
char buffer[128];
LVITEM item;
int i = index;
memset(&item, 0 ,sizeof(item));
item.iItem = i;
item.mask = LVIF_TEXT;
item.iSubItem = 0;
item.pszText = (char *) pszMachineName;
m_ServerListControl.SetItem(&item);
item.iSubItem = 1;
sprintf(buffer, "%.2lf %", cpu);
item.pszText = buffer;
m_ServerListControl.SetItem(&item);
item.iSubItem = 2;
sprintf(buffer, "%ld", mem);
item.pszText = ToThousand(buffer);
m_ServerListControl.SetItem(&item);
item.iSubItem = 3;
sprintf(buffer, "%ld", network);
item.pszText = ToThousand(buffer);
m_ServerListControl.SetItem(&item);
item.iSubItem = 4;
sprintf(buffer, "%ld", processMem);
item.pszText = ToThousand(buffer);
m_ServerListControl.SetItem(&item);
item.iSubItem = 5;
sprintf(buffer, "%ld", processHandle);
item.pszText = ToThousand(buffer);
m_ServerListControl.SetItem(&item);
}
m_List.SetColumnHeader(_T("STEP, 50; abc, 70; bcd, 70"));
m_List.SetGridLines(TRUE);
m_List.SetEditable(TRUE);
'개발자 > MFC' 카테고리의 다른 글
Visual C++ 6.0 MFC 사용시 클래스 사라졌을때 (0) | 2009.11.19 |
---|---|
MFC 트리 콘트롤, 구조체 정의 하여 사용 (0) | 2009.11.19 |
댓글