How do I change name of a process on task manager in C++?

5.3k Views Asked by At

I have a process with name as "processName" and executable as "processName.exe". I want to launch this process and change name of the process of how it appears in task manager. I can not just rename the executable because I want to have space in name. For example it should look like "ProcessName somethingelse" in task manager. I can see some programs doing this, for example for command prompt executable name is "cmd.exe" but name on command prompt is "Windows Command Processor" which has space in it's name.

1

There are 1 best solutions below

4
On

The application/task name is the title of the main window (a chapter of its own). You can change your own title using SetWindowText:

BOOL SetWindowTextA( // Ansistring version
  HWND   hWnd,       // handle to your main window
  LPCSTR lpString    // new name
);

or

BOOL SetWindowTextW( // Widestring version
  HWND    hWnd,
  LPCWSTR lpString
);