Perl CookbookPerl CookbookSearch this book

15.17. Removing the DOS Shell Window with Windows Perl/Tk

15.17.1. Problem

You have written a Perl program for the Windows port of Perl and Tk, but you get a DOS shell window every time you start your program.

15.17.2. Solution

Add this to the start of your program:

BEGIN {
  if ($^O eq 'MSWin32') {
    require Win32::Console;
    Win32::Console::Free( );
  }
}

15.17.3. Description

The Win32::Console module lets you control the terminal window that launched your program. All you need to do is close that window (or Free it in, in the peculiar parlance of the Windows API) and voilà—no pesky DOS shell window.

15.17.4. See Also

The documentation for the Win32::Console module, which is included with distributions of Perl destined for Microsoft systems



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.