yjm0105 阅读(777) 评论(0)
//获取进程列表
HANDLE hd=CreateToolhelp32Snapshot(TH32CS_SNAPALL,NULL);
 PROCESSENTRY32 pt;
 pt.dwSize=sizeof(PROCESSENTRY32);
 CString strP,str1;
 if(hd)
 {
  if(Process32First(hd,&pt))
  {
   strP=pt.szExeFile;
   while(Process32Next(hd,&pt))
   {
    str1=pt.szExeFile;
    if(str1.GetLength()<8)
     str1+="\t";
    strP+="\n"+str1;
    str1.Format("\tPID:%d \tPPID:%d",pt.th32ProcessID,pt.th32ParentProcessID);
    strP+=str1;
    if(!strcmp(pt.szExeFile,"xdict.exe"))
    {
     HANDLE hDel;
     if((hDel=OpenProcess(PROCESS_TERMINATE ,0,pt.th32ProcessID)))         
      ;//TerminateProcess(hDel,0);     
    }
   }
  }
 }
 AfxMessageBox(strP);

发表评论
切换编辑模式