in reply to STDOUT and a PAR --gui executable
If No. 1 is true, then I need to find out how to suppress the console from a perl EXE and still get STDOUT if run from a command line. Anybody know how to do this or what's going on?
In general, what you're asking for is not possible with windows, whether in a perl EXE or not. If a windows executeable is marked as a gui executeable, it is given no access to the console when launched from the command line; if it is not marked as a gui application, it is always given a console, creating one if necessary. You can close it right away, but it'll still flash briefly on the screen.
That being said, there is a function new in Windows XP (and Windows Server 2003) that lets you re-attach to the parent console. But you don't really want to do that, because your output will get messed up with the command prompt, and you still can't do something like pipe your output through more, etc.
So instead, use the workaround suggested in this article (in the answer to the second question). That is, create two executeables, one as a gui application and one as a console application, and name the console version the same thing as the gui but with the name ending in .com, not .exe. Put the pretty icon on the .exe version. Then, when run from the command line, the .com version will get run (since windows searches for .com before .exe), but when people click things they'll click on the .exe.
Filling in the rough edges here is left as an exercise for the reader, such as launching the pure-GUI version (or detaching from the console in some other manner) when they don't specify -verbose on the command line, etc. (the article touches on some of that)
This ugly workaround is what Microsoft does with .Net (mentioned in the article).
|
|---|