DWORD pProcessIds[256]; DWORD cb = 256; DWORD pBytesReturned; if(!EnumProcesses(pProcessIds,cb,&pBytesReturned)) return 0; long lnoofprocess = pBytesReturned/sizeof(DWORD); DWORD dwDesiredAccess = PROCESS_QUERY_INFORMATION; BOOL bInheritHandle = TRUE; for(long i=0; i<lnoofprocess; i++){ DWORD dwProcessId = pProcessIds[i]; HANDLE hProcess=NULL; hProcess = OpenProcess(dwDesiredAccess,bInheritHandle,dwProcessId); if(hProcess==NULL) continue; LPSTR lpImageFileName = new char[256]; DWORD nSize = 256; if(!GetProcessImageFileNameA(hProcess,lpImageFileName,nSize)) continue; char *pfrdslh = strrchr(lpImageFileName, 92); cout<<pfrdslh+1<<endl; delete [] lpImageFileName; }
Friday, July 13, 2012
Print all running process in windows using vc++
Labels:
vc++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment