Forum > General
Controlling another process executed by T(Async)Process' process
Leledumbo:
I want to build Windows' cmd wrapper because I want larger view and tabbed interface. I saw some projects on the net like eConsole (Delphi) and Console2 (inspired by eConsole, but written in C++), both can handle how cmd executes another program (and both uses Windows API's CreateProcess). That is, they can suppress console window created by that another program. However in fpc (or Lazarus) case, even if I set ShowWindow to swoNone and one of Options is poNoConsole, program still opens console window.
If it's not really clear what I mean, please see attached screenshot. As you can see, the output of fpc in Console2 (left) is written on the memo, while my app (right) opens a console window.
Troodon:
Just a coment: I have noticed a similar behaviour upon trying to launch mplayer embedded in a Windows app using poNoConsole: the mplayer console window will pop-up anyway. That doesn't happen in Linux, though. I had a quick look at how the MPlayer GUI folks worked around this issue (Delphi 7 code) and they appear to collect output using pipes.
Update: the issue is no longer apparent with MPlayer-athlon-svn-31027.
Leledumbo:
Update: I can now redirect all output to memo, using poNewConsole. But then a blank console opens. How can I close it?
Ocye:
Does it depend on compiler setting "Win32 GUI" (-WG)?
Leledumbo:
--- Quote ---Does it depend on compiler setting "Win32 GUI" (-WG)?
--- End quote ---
Nope, it's for the main application, not a child process that we execute. So, basically here's what happened:
--- Code: ---My app (1)
| executes using TProcess
cmd (2)
| executes using ... something implemented by MS, CreateProcess perhaps
whatever sent to cmd (3)
--- End code ---
poNoConsole:
no command prompt window for (2), but yes for (3). (3) output is sent to the command prompt window
poNewConsole:
command prompt window for (2), but empty. (3) output is sent to (2).
Navigation
[0] Message Index
[#] Next page