其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
Windows XP系统进程

作者:未知 来源:月光软件站 加入时间:2005-5-13 月光软件站

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);

}

有问题联系我

[email protected]




相关文章

相关软件