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

Hello, I have the following code as a test case, and I'm trying to detach the DOS window from the current process, but I haven't had any luck. The dos window still appears. Any suggestions?
#!/c:/perl use Win32; use Win32::Process; use Tk; use Tk::HList; use Tk::Notebook; Win32::Process::Create($Win32::Process::Create::ProcessObj, 'C:/perl/bin/perl.exe', 'perl c:/perl/Format.pl', 0, DETACHER_PROCESS, ".") or die print_error(); use vars qw($int $entry); &init_ui(); MainLoop; sub init_ui { my $mw = MainWindow->new; $mw->title("TEST CASE"); } sub print_error() { return Win32::FormatMessage( Win32::GetLastError() ); }
Thanks for the help

Replies are listed 'Best First'.
Re: DOS shell window removal
by strat (Canon) on Mar 29, 2002 at 18:44 UTC
    With Activestate-Perl, there's also another possibility: in the perl/bin-Directory exists a binary called wperl.exe. If you use this instead of perl.exe for tk-Scripts, the shellwindow is automatically removed.
    Perhaps you could assotiate the ending .ptk or the like with wperl.exe ...

    Best regards,
    perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Re: DOS shell window removal
by gellyfish (Monsignor) on Mar 29, 2002 at 18:27 UTC

    You might want to see this to start with.

    /J\

Re: DOS shell window removal
by belg4mit (Prior) on Mar 29, 2002 at 20:36 UTC
    Both prior nodes are spot on, a final thing to note is that DOS boxes usually wil not be "undrawn"/closed by Windows if there is any text within them, this is why a good batch file for Windows ends in cls. Just something to keep in mind, i.e. clear if you print before you detach.

    --
    perl -pe "s/\b;([st])/'\1/mg"