Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco::Process settings

A general discussion forum.

Poco::Process settings

Postby smallFish » 16 May 2014, 12:41

Greetings,

I'm trying to set process name and process description of processes, that I launched by "Poco::Process::launch" function.
And I can't manage it. Is there a way to set it somehow?

I found that inside "Poco::Process::launch" you call "ProcessImpl::launchImpl", implementation depends on operating system family.
inside "ProcessImpl::launchImpl" for Windows you set structure this way:

Code: Select all
   STARTUPINFOW startupInfo;
   GetStartupInfoW(&startupInfo); // take defaults from current process
   startupInfo.cb          = sizeof(STARTUPINFOW);
   startupInfo.lpReserved  = NULL;
   startupInfo.lpDesktop   = NULL;
   startupInfo.lpTitle     = NULL;
   startupInfo.dwFlags     = STARTF_FORCEOFFFEEDBACK;
   startupInfo.cbReserved2 = 0;
   startupInfo.lpReserved2 = NULL;

//...

   BOOL rc = CreateProcessW(
      NULL, // applicationName
      const_cast<wchar_t*>(ucommandLine.c_str()),
      NULL, // processAttributes
      NULL, // threadAttributes
      mustInheritHandles,
      creationFlags,
      (LPVOID) pEnv,
      workingDirectory,
      &startupInfo,
      &processInfo
   );

That is why, I guess, Title of creating process can't be set. Isn't it?

Also, for example, my host process was not created by "CreateProcess", but I should be able to set it's properties somehow?
smallFish
 
Posts: 3
Joined: 04 Apr 2014, 10:39

Re: Poco::Process settings

Postby alex » 16 May 2014, 16:53

You can change the title of your process window after launching using SetWindowText. I vaguely remember that you obtain HWND by searching for a window with known title. You can also use SetConsoleTitle.
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Poco::Process settings

Postby smallFish » 19 May 2014, 09:18

alex wrote:You can change the title of your process window after launching using SetWindowText. I vaguely remember that you obtain HWND by searching for a window with known title. You can also use SetConsoleTitle.


So there is no way to set process name and description using Poco? It is not necessary to set it after launching, I would set it before, if possible, or inside (i.e. forst process instructions would change it's description). If that is possible by Poco. I just want to use Poco, because I use this library for all other process management. I don't need in Poco process management if I still have to use WinAPI for that.
smallFish
 
Posts: 3
Joined: 04 Apr 2014, 10:39

Re: Poco::Process settings

Postby alex » 20 May 2014, 02:34

No, there is currently no way. POCO is POrtable COmponents and Poco::Process does not aim to launch only processes with GUI interface on Windows (in fact, POCO does not even presume to be running on an OS with a GUI) so we did not deem it necessary to provide access to that feature.
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Poco::Process settings

Postby smallFish » 20 May 2014, 10:33

alex wrote:No, there is currently no way. POCO is POrtable COmponents and Poco::Process does not aim to launch only processes with GUI interface on Windows (in fact, POCO does not even presume to be running on an OS with a GUI) so we did not deem it necessary to provide access to that feature.

My processes don't have gui, so, I'm talking about process name in Task Manager, not about GUI title. For unix it is easy to handle - just changing argv[0] of program, but for windows there is a heap of bicycle solutions, and I don't like any of them. If you have name for launched threads, I thought name for launched process don't goes against your conception, and may be implemented.
I run multiple child processes for multiple python scripts (one for one), and for administrator it would be helpful if I could rename child processes to names of scripts they run, to understand which one is still working, which one not. That is why I'm looking for that.
Anyway thank you :-)
smallFish
 
Posts: 3
Joined: 04 Apr 2014, 10:39

Re: Poco::Process settings

Postby alex » 21 May 2014, 02:52

Your original question was referring to startupinfo.lpTitle, which is GUI Window title so I was talking about that. If you need this feature, contributing is very easy - send a github pull request and, if it's good, has a reasonable amount of test(s) and follows coding standards, we merge expediently.
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron