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";