I want to store the executable name without the directory (i.e. system.exe).
How can I do this?
HANDLE Handle = OpenProcess(PROCESS_ALL_ACCESS, 0, ProcessID);
if (GetModuleFileNameEx(Handle, 0, (LPWSTR)exename, sizeof(exename) - 1))
{
ProcessName = (wchar*)exename; // I want to store only the executable name without "C:\\..."
}
Did you search MSDN?
There you can find the functions PathFindFileName
and PathFindExtension
that you can utilize to build your file name.