Forum > Windows

how to close or control an attached console from GUI

<< < (2/2)

ezlage:
Are you able to replace the closing mechanism with some other that just hides the window?

And if you build a custom launcher and, from it, you start, suspend, resume, finish or restart whatever you want through TProcess?

From the intermediate process you can send and receive data from the others via pipeline, as well as from SimpleIPC.

robert rozee:
i had considered just that - having my executable launch a copy of itself, and one copy act as a hidden 'server' sitting between the console window and GUI copy. the problem with this, however, is a big chunk of memory resources (30mb) is thrown away supporting a seldom used (for my application) diagnostics feature. despite RAM being cheap and plentiful these days, it irks me! as for a custom launcher, i really want to keep to one, single, executable file.

my application, in its current form, is designed for Linux, and i am porting it to also run on Windows (win32/XP). the nice thing about Linux is that you can just talk to the console, and if it is not there nothing bad happens. also, when a GUI application is launched from a console the GUI application keeps control of the console (not detached, line under Windows). this is the kind of behaviour i'm after mimicking as far as is possible. Windows actually has a slight advantage, as it is able to detect the presence of a console, whereas Linux can not (and doesn't need to, as standard I/O without a console just disappears).

btw, i have found that i can suspend the 'command processor' process attached to the console, but when i go to resume it upon the GUI exiting, the console just sits frozen/dead.


cheers,
rob   :-)

Navigation

[0] Message Index

[*] Previous page

Go to full version