Haven't posted in a while, figured I'd give you guys something from my personal code stash I've built up over the years.

It wouldn't let me create a new thread in the tutorials section, so I've posted it here...
Here's a little piece of code that'll get the exe name for each running process. You'll need to include windows.h.
HANDLE hSnapShot=NULL;
HANDLE hResult = NULL;
PROCESSENTRY32 processInfo;
char* pstrExeName;
bool bFirst = true;
::ZeroMemory(&processInfo, sizeof(PROCESSENTRY32));
processInfo.dwSize = sizeof(PROCESSENTRY32);
hSnapShot = CreateToolhelp32Snapshot(
TH32CS_SNAPPROCESS, 0);
if(hSnapShot == INVALID_HANDLE_VALUE)
return NULL;
while((bFirst ? Process32First(hSnapShot,
&processInfo) : Process32Next(hSnapShot,
&processInfo)))
{
bFirst = false;
pstrExeName = strrchr(processInfo.szExeFile, '\\');
if(!pstrExeName)
pstrExeName = processInfo.szExeFile;
else
pstrExeName++;
// Do whatever you want with the name here. In my
// BPK program it puts the string in the listbox on the left
}
if(hSnapShot)
CloseHandle(hSnapShot); Enjoy!
For an example of this piece of code in action, see my process utility here:
http://www.freewebs.com/wombatex/bpk.htm