Hi Seb,

Since you're in Windows, nobody cares about that #!path/to/perl. :)
If you wish wperl.exe to process your scripts instead of perl.exe, associate 
.pl file extension with wperl.exe. That's all.
But I think that's not good because if you do it all your scripts will be 
launched with no console screen. 
Better run your scripts like "path/to/wperl.exe script.pl".


Regards,
_____
Ilya

-----Original Message-----
From: Seb [mailto:s...@h-k.fr] 
Sent: Thursday, December 24, 2009 12:50 PM
To: Kevin Marshall
Cc: Perl-Win32-GUI-Users List
Subject: Re: [perl-win32-gui-users] Windows shutdown


Hi Kevin,


| If you have ActiveState Perl, you could try running the script using the
| wperl.exe program instead. This runs the script without displaying a
| console. This means that any output won't be seen, but I tried it with
| the sample code that Jeremy provided and it worked OK for me.

It works, at least when I call the script manually from a terminal with
"wperl foo.pl".

When I double click on the script's icon from Explorer, though, it seems
that the information given on the first line (I put
#!C:\Perl\bin\wperl.exe) is not taken into account. This is a very basic
question, I'm sorry: how do I get around ActiveState's magic to force the
script to call wperl instead of perl?


Thanks !
Seb.



| > Date: Thu, 24 Dec 2009 00:43:54 +0100
| > From: s...@h-k.fr
| > To: jez_wh...@hotmail.com
| > CC: perl-win32-gui-users@lists.sourceforge.net
| > Subject: Re: [perl-win32-gui-users] Windows shutdown
| >
| >
| > Hi Jeremy,
| >
| >
| > | Something like below - I didn't have time to test it fully, but
| > | something is printed when I shutdown.
| > |
| > | use strict; use Win32::GUI qw (WM_QUERYENDSESSION); my $main =
| > | Win32::GUI::Window->new(-name => 'Main', -text => 'Perl', -width => 200,
| > | -height => 200);$main->AddLabel(-name => "Label", -text => "Hello,
| > | world", -left => 20, -top => 20, -notify =>
| > | 1);$main->Hook(WM_QUERYENDSESSION,\
| > | &EndSession);$main->Show();Win32::GUI::Dialog(); sub EndSession { print
| > | "WM_QUERYENDSESSION fired\n"; return 0;}
| >
| > It doesn't work for me, so I'll detail my steps.
| >
| > I put this code in a .pl file, reformatted it, then double clicked on the
| > icon of the program. This opened a black terminal and a small window with
| > "Hello, world". Then I clicked on the Start Menu, chose Stop. Windows (XP)
| > then shows an error message saying that Windows cannot terminate this
| > program; it offers to either terminate the program now or cancel.
| >
| > Does Windows shut down when you follow the same steps? Is there something
| > you're doing differently?
| >
| > I tried adding the WM_CLOSE signal, but the result is the same. Same thing
| > when I change EndSession's definition for an "exit(0)".
| >
| > So close and yet...
| >
| > Thanks alot for your time and help. Hope you can guide me through the last
| > step!
| >
| >
| > Seb.
| >
| >
| > | > Date: Wed, 23 Dec 2009 23:41:11 +0100
| > | > From: s...@h-k.fr
| > | > To: jez_wh...@hotmail.com
| > | > CC: perl-win32-gui-users@lists.sourceforge.net
| > | > Subject: Re: [perl-win32-gui-users] Windows shutdown
| > | >
| > | >
| > | > Hi Jeremy,
| > | >
| > | >
| > | > | One thing that did strike me when reading your mail was when you said
| > | > | "application does not in itself require a GUI". When you hooked
| > | > | WM_QUERYENDSESSION + WM_ENDSESSION, are you sure your application is
| > | > | sitting on the event pump (Win32::GUI::Dialog) when windows shuts 
down?
| > | > | If it's not, then you wont get the messages before it's too late...
| > | >
| > | > I'm pretty sure my code isn't at all what it's supposed to look like :-)
| > | > If it's not too much trouble, could you send a working example with 
these
| > | > variables and Win32::GUI::Dialog ? The simplest things can be hell to 
put
| > | > together in the right order when it's done for the first time...
| > | >
| > | >
| > | > Thanks!
| > | > Seb.
| > | >
| > | >
| > | >
| > | > | > Date: Wed, 23 Dec 2009 13:19:41 +0100
| > | > | > From: s...@h-k.fr
| > | > | > To: perl-win32-gui-users@lists.sourceforge.net
| > | > | > Subject: [perl-win32-gui-users] Windows shutdown
| > | > | >
| > | > | >
| > | > | > Hi folks,
| > | > | >
| > | > | >
| > | > | > Here is the question: I'm looking for a minimal example of a (perl) 
script
| > | > | > that dies (gracefully or not) when Windows tries to shutdown.
| > | > | >
| > | > | > Story: I have developed an application that monitors via RS232 the 
health
| > | > | > of TV screens attached to PCs. The information gathered is relayed 
to a
| > | > | > central server. This application must run continuously, but still 
die
| > | > | > when an automatic shutdown is triggered on the PC. The application 
works
| > | > | > but doesn't die when asked to (via Start->Stop).
| > | > | >
| > | > | > I have a fair knowledge of Perl and Unix, but I am totally new to 
Windows
| > | > | > programming: don't hesitate to state an obvious solution :-) Please 
note
| > | > | > that the application does not in itself require a GUI. I tried a GUI
| > | > | > following the discussion here:
| > | > | > 
http://objectmix.com/perl/20692-win32-how-quit-perl-script-during-log-off-automatically.html
| > | > | > A solution that would use Win32::API would also work for me, I just
| > | > | > thought it might be simpler with Win32::GUI.
| > | > | > I have tried to use GetMessage and PeekMessage, but I'm clearly not 
using
| > | > | > them the right way (again, I know zilsch about Windows programming).
| > | > | >
| > | > | > I've read the archives on mail-archive.com and found discussions 
dating
| > | > | > back to 2001 and 2004; they do not provide a working example alas. 
I also
| > | > | > tried to understand the man pages on CPAN and the samples in the 
tarball,
| > | > | > but couldn't find a hint there either.
| > | > | >
| > | > | > Any hope, err, help, would be much appreciated!
| > | > | >
| > | > | >
| > | > | > Seb.
| > | > | >
| > | > | >
| > | > | > 
------------------------------------------------------------------------------
| > | > | > This SF.Net email is sponsored by the Verizon Developer Community
| > | > | > Take advantage of Verizon's best-in-class app development support
| > | > | > A streamlined, 14 day to market process makes app distribution fast 
and easy
| > | > | > Join now and get one step closer to millions of Verizon customers
| > | > | > http://p.sf.net/sfu/verizon-dev2dev
| > | > | > _______________________________________________
| > | > | > Perl-Win32-GUI-Users mailing list
| > | > | > Perl-Win32-GUI-Users@lists.sourceforge.net
| > | > | > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
| > | > | > http://perl-win32-gui.sourceforge.net/
| > | > |
| > | > | _________________________________________________________________
| > | > | Use Hotmail to send and receive mail from your different email 
accounts
| > | > | http://clk.atdmt.com/UKM/go/186394592/direct/01/
| > | >
| > | > 
------------------------------------------------------------------------------
| > | > This SF.Net email is sponsored by the Verizon Developer Community
| > | > Take advantage of Verizon's best-in-class app development support
| > | > A streamlined, 14 day to market process makes app distribution fast and 
easy
| > | > Join now and get one step closer to millions of Verizon customers
| > | > http://p.sf.net/sfu/verizon-dev2dev
| > | > _______________________________________________
| > | > Perl-Win32-GUI-Users mailing list
| > | > Perl-Win32-GUI-Users@lists.sourceforge.net
| > | > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
| > | > http://perl-win32-gui.sourceforge.net/
| > |
| > | _________________________________________________________________
| > | Use Hotmail to send and receive mail from your different email accounts
| > | http://clk.atdmt.com/UKM/go/186394592/direct/01/
| >
| > 
------------------------------------------------------------------------------
| > This SF.Net email is sponsored by the Verizon Developer Community
| > Take advantage of Verizon's best-in-class app development support
| > A streamlined, 14 day to market process makes app distribution fast and easy
| > Join now and get one step closer to millions of Verizon customers
| > http://p.sf.net/sfu/verizon-dev2dev
| > _______________________________________________
| > Perl-Win32-GUI-Users mailing list
| > Perl-Win32-GUI-Users@lists.sourceforge.net
| > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
| > http://perl-win32-gui.sourceforge.net/
|
| _________________________________________________________________
| Looking for a great date? Meet singles at ninemsn dating
| http://clk.atdmt.com/NMN/go/150855801/direct/01/


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to