Overview
Features
Download
Documentation
Community
Add-Ons & Services

How to silently start process using Poco/Process or other op

A general discussion forum.

How to silently start process using Poco/Process or other op

Postby umen » 22 May 2011, 14:13

Hello all
I need to start process and read its stdout output ,without starting the cmd(dos black window)
Can I do that? For example I have this code that opning the cmd window . this is what I like to avoid .

Code: Select all
std::string cmd = "C:\\WINDOWS\\system32\\ipconfig";
std::vector<std::string> args;
args.push_back("--help");
   
Pipe outPipe;
ProcessHandle ph = Process::launch(cmd, args, 0, &outPipe, 0);
PipeInputStream istr(outPipe);
std::string s;
int c = istr.get();
while (c != -1) { s += (char) c; c = istr.get(); }
int rc = ph.wait();
umen
 
Posts: 4
Joined: 18 May 2011, 10:25

Re: How to silently start process using Poco/Process or othe

Postby MrT » 26 May 2011, 13:27

I'm actually in the same situation, I tried searching Google and POCO Documentation but couldn't find an answer
to how running a process silently.

Did you found a solution?

Thanks.
MrT
 
Posts: 2
Joined: 26 May 2011, 13:25

Re: How to silently start process using Poco/Process or othe

Postby bird » 27 May 2011, 06:06

I don't believe that feature is available in Poco Process.

I had to modify the ProcessImpl::launchImpl() function in Foundation/Process_WIN32.cpp to suppress the cmd window from opening.

Code: Select all
STARTUPINFO startupInfo;
   startupInfo.dwFlags     = STARTF_FORCEOFFFEEDBACK | STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
   startupInfo.wShowWindow = SW_HIDE;


-Steve
bird
 
Posts: 19
Joined: 22 Sep 2007, 16:57

Re: How to silently start process using Poco/Process or othe

Postby MrT » 28 May 2011, 15:59

Thank you very much Steve, I really appreciate.
MrT
 
Posts: 2
Joined: 26 May 2011, 13:25


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest