Windows XP系统进程

王朝system·作者佚名  2006-01-09
宽屏版  字体: |||超大  

BOOL MYXXX::OnInitDialog()

{

...

m_wndListCtrl.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);

m_wndListCtrl.InsertColumn(0xffff, "cntThreads", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "cntUsage", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "dwFlags", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "dwSize", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "pcPriClassBase", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "szExeFile", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "th32DefaultHeapID", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "th32ModuleID", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "th32ParentProcessID", LVCFMT_LEFT, 80, 0);

m_wndListCtrl.InsertColumn(0xffff, "th32ProcessID", LVCFMT_LEFT, 80, 0);

SetTimer(1, 1000, NULL);

...

}

void myxxx::OnTimer(UINT nId)

{

HANDLE hSnapshot;

PROCESSENTRY32 processListStr;

processListStr.dwSize = sizeof PROCESSENTRY32;

BOOL bRet;

int i;

hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

bRet = Process32First(hSnapshot, &processListStr);

m_wndList.ResetContent();

m_wndListCtrl.DeleteAllItems();

while (bRet)

{

CString str;

int nIndex;

str.Format("%d", processListStr.cntThreads);

nIndex = m_wndListCtrl.InsertItem(0xffff, str, 0);

str.Format("%d", processListStr.cntUsage);

m_wndListCtrl.SetItem(nIndex, 1, 1, str, 0, 0, 0, 0);

str.Format("%d", processListStr.dwFlags);

m_wndListCtrl.SetItem(nIndex, 2, 1, str, 0, 0, 0, 0);

str.Format("%d", processListStr.dwSize);

m_wndListCtrl.SetItem(nIndex, 3, 1, str, 0, 0, 0, 0);

str.Format("%d", processListStr.pcPriClassBase);

m_wndListCtrl.SetItem(nIndex, 4, 1, str, 0, 0, 0, 0);

str.Format("%s", processListStr.szExeFile);

m_wndListCtrl.SetItem(nIndex, 5, 1, str, 0, 0, 0, 0);

str.Format("%d", processListStr.th32DefaultHeapID);

m_wndListCtrl.SetItem(nIndex, 6, 1, str, 0, 0, 0, 0);

str.Format("%d", processListStr.th32ModuleID);

m_wndListCtrl.SetItem(nIndex, 7, 1, str, 0, 0, 0, 0);

str.Format("%d", processListStr.th32ParentProcessID);

m_wndListCtrl.SetItem(nIndex, 8, 1, str, 0, 0, 0, 0);

str.Format("%d", processListStr.th32ProcessID);

m_wndListCtrl.SetItem(nIndex, 9, 1, str, 0, 0, 0, 0);

bRet = Process32Next(hSnapshot, &processListStr);

}

CDialog::OnTimer(nIDEvent);

}

有问题联系我

cyin8@126.com

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有