Johan Lindstrom wrote: > Jeremy Aiyadurai wrote: > >how do i get an icon to work for a console window...eg. i want to get rid > >of the console-window-dos-prompt icon when i run my console program. > > Untested, but try something like this: > > my $icoDOS = ... create your icon object here ...; > my $hwindDOS = Win32::GUI::GetPerlWindow(); > Win32::GUI::SetIcon($hwindDOS, $icoDOS, 0);
The above should work (I recently tried it) but it even removes the command prompt if you type perl yourprogram.pl in the command window. Another way I use is the following batch file, starting a perl script which creates another process. This example works with Perl/Tk, too. Try it and use your favourite method :-) --- cut here and save it in a file like myprogram.bat --- @rem = '--*-Perl-*-- @echo off if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S "%0" %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have Perl in your PATH. goto endofperl @rem '; #!perl #line 14 # Starts a perl script without console window use strict; use Win32; use Win32::Process; #--------------------------------------------------------------------------- # main findPerl(); Win32::Process::Create($Win32::Proccess::Create::ProcessObj, findPerl(), 'perl yourprogram.pl', 0, DETACHED_PROCESS, ".") or die print_error(); sub print_error { return Win32::FormatMessage(Win32::GetLastError()); } #--------------------------------------------------------------------------- # sub sub findPerl { foreach my $path (split(/;/, $ENV{PATH})) { if (-e "$path\\perl.exe") { return "$path\\perl.exe"; } } } __END__ :endofperl --- cut here --- Peter http://www.metaprojekt.de