to more http://community.csdn.net/Expert/topic/3918/3918301.xml?temp=.6211206
解决了,加上#include <tlhelp32.h>头文件 可以取出来 szExeFile Path and filename of the executable file for the process. th32ProcessID Identifier of the process. The contents of this member can be used by Win32 API elements.
但是我用的时候总是报错1151
而1151是The specified program is not a Windows or MS-DOS program.
真郁闷,关注中
回复人: BigFanOfCpp(((Bytes)+_ALGIN-1) & ~(_ALGIN-1)) ( ) 信誉:100 2005-05-11 09:35:00 得分: 0
见我的blog:
http://blog.csdn.net/bigfanofcpp或者用下面的方法:
HANDLE hSnapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); PROCESSENTRY32 pe;
::ZeroMemory(&pe,sizeof(pe));
pe.dwSize = sizeof(pe); BOOL bMore = ::Process32First(hSnapshot,&pe); while(bMore){ //循环到没有
HANDLE hProcess = ::OpenProcess(
PROCESS_QUERY_INFORMATION,
FALSE,pe.th32ProcessID);
if(hProcess != NULL){
CString id;
id.Format("Process ID: %d",pe.th32ProcessID);
AfxMessageBox(id,MB_OK);
}
::CloseHandle(hProcess); //移到下一个进程
bMore = ::Process32Next(hSnapshot,&pe);
}
to more
http://community.csdn.net/Expert/topic/3918/3918301.xml?temp=.6211206
可以取出来
szExeFile
Path and filename of the executable file for the process.
th32ProcessID
Identifier of the process. The contents of this member can be used by Win32 API elements.