Hi all,

Just a quick question, (at least I think that it's quick!).
I've seen on some sites that it's possible to hide the dos window using the Win32::API::Prototype module.
I've installed it but the function "GetConsoleWindow()" seems to be missing.
Does anyone know what I've done wrong, or is there something else I should be using.

Below is the code that supposed to hide the dos console...

If anyone has any idea why this is going screwy or another way to hide the dos console window, I'd be extremely greatful.

Thanks,
Buzzthebuzzsaw.

use Win32::API::Prototype; ApiLink( 'KERNEL32.DLL', 'HWND GetConsoleWindow()' ); ApiLink( 'USER32.DLL', 'BOOL ShowWindow( HWND hWnd, int iCommand )' ); $hWnd = GetConsoleWindow(); print "About to hide the window...\n"; sleep( 1 ); # Hide the window. # BEGIN CALLOUT A ShowWindow( $hWnd, 0x00 ); # END CALLOUT A print "Now let's count to 100:\n"; foreach my $Count ( 1..100 ) { print "$Count, "; } print "\n"; sleep( 5 ); print "About to restore the window...\n"; # Restore the window. # BEGIN CALLOUT B ShowWindow( $hWnd, 0x04 ); # END CALLOUT B print "Restored!\n";

In reply to Hiding the dos console where perl program was called from in windows? by buzzthebuzzsaw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.