in reply to Re^2: Hiding programs launched within wperl'd script
in thread Hiding programs launched within wperl'd script

In a wperl.exe app, I run the following at startup:
my $AllocConsole = new Win32::API('kernel32', 'AllocConsole', [] , 'N' +); my $GetConsoleWindow = new Win32::API('kernel32', 'GetConsoleWindow', +[] , 'N'); my $ShowWindow = new Win32::API('user32', 'ShowWindow', ['N','I'] , 'N +'); my $apival = $AllocConsole->Call(); if($apival) { my $console = $GetConsoleWindow->Call(); my $hidewindow = 0; my $rval = $ShowWindow->Call($console, $hidewindow); }
So I've now got a hidden console window that any console apps I call will run in. The console may flash once on app startup, but after that you're OK.

Replies are listed 'Best First'.
Re^4: Hiding programs launched within wperl'd script
by mdog (Pilgrim) on Jan 18, 2006 at 17:56 UTC
    markwx --

    Thanks for the advice...Having a hidden console window to run your apps in? Great thinking...didn't even know it was possible. Haven't tested this out, yet (work is slamming) but this seems like a real winner!

    Thanks for the code sample!

    Matt

    PS Once I get something working, I will post it so folks can see.

      See bottom of this post for the answer!
Re^4: Hiding programs launched within wperl'd script
by mdog (Pilgrim) on Jan 18, 2006 at 23:18 UTC
    markwx --

    I'm having a hard time figuring out how you pass your command into the $console handle you have created to run your program and get a scalar back of the value of the program you just ran.

    If you wouldn't mind, could you post how you interact with the console?

    Much appreaciated!
    Matt