westhills has asked for the wisdom of the Perl Monks concerning the following question:

I've got an app I developed using Activestate Perl 5.6 and which is compiled using PerlApp 5.03. Runs just fine from the command prompt. The client now wants the program to be launched from the system tray. So, I modified the sample code that came with PerlTray and call the compiled EXE at intervals (or on a menu selection) using the system command, as follows:
system("$exe_name");
However, each time the EXE runs, it brings up a console window. I'd like to suppress the console window, as it's very disruptive to the user. I've added the --gui parameter when I compile the EXE using PerlApp, but the window still comes up when I run the EXE. Backticks work the same way, and Exec terminates the program. Any ideas, short of rewriting and integrating the two programs, to make the console not show up?
Thanks.
--Mark in WestHills

Replies are listed 'Best First'.
Re: Suppressing Console in PerlApp Script
by jand (Friar) on May 07, 2003 at 19:09 UTC
    Add this line to the top of your PerlTray application:
    Win32::SetChildShowWindow(0) if defined &Win32::SetChildShowWindow +;
    It should hide all applications started by system() if your version of Perl includes Win32::SetChildShowWindow(). It definitely is included in ActivePerl build 633 and later.
      EXCELLENT!!!
      For the record, build 631 doesn't have it. I upgraded to 635 and it works just fine without bringing up the console window.
      Thank YOU!
      --Mark in West Hills
      Excellent! It also works with a standard app and not compiled by the way ;)