Update of /cvsroot/popfile/engine/Platform
In directory sc8-pr-cvs1:/tmp/cvs-serv12319/Platform
Modified Files:
MSWin32.pm
Log Message:
USING PERLTRAY TO BUILD A POPFILE.EXE FOR WINDOWS
Makefile:
Suitable targets to use PerlTray to created popfile.exe and
popfileb.exe.
POPFile/Loader.pm:
Added version() accessor for version string and an option to
service so that it can be called from an external poller.
popfilew.pl:
Equivalent of popfile.pl which uses PerlTray to show an icon
in the system tray on Windows. This is designed to be turned
into popfile.exe by PerlTray.
Index: MSWin32.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Platform/MSWin32.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** MSWin32.pm 10 Sep 2003 18:26:28 -0000 1.10
--- MSWin32.pm 12 Sep 2003 00:34:36 -0000 1.11
***************
*** 5,10 ****
@ISA = ("POPFile::Module");
- use Win32::API;
-
#----------------------------------------------------------------------------
#
--- 5,8 ----
***************
*** 144,227 ****
return '';
- }
-
- # ---------------------------------------------------------------------------------------------
- #
- # prefork
- #
- # Called when a fork is about to occur
- #
- # ---------------------------------------------------------------------------------------------
- sub prefork
- {
- my ( $self ) = @_;
-
- # If the fork occurs and the DLL handling the icon is still present then
- # there's going to be a problem because the DLL will get unloaded and we'll
- # still have a pointer into it, so here we unload the DLL, it will get reloaded
- # automatically later
-
- undef $self->{getmessage__};
- }
-
- # ---------------------------------------------------------------------------------------------
- #
- # service
- #
- # Called to handle interface requests
- #
- # ---------------------------------------------------------------------------------------------
- sub service
- {
- my ( $self ) = @_;
-
- if ( !$self->config_( 'trayicon' ) ) {
- return 1;
- }
-
- if ( !defined( $self->{getmessage__} ) ) {
- $self->{getmessage__} = Win32::API->new( "Platform/POPFileIcon.dll", "GetMenuMessage", "", "N" );
- }
-
- my $event = $self->{getmessage__}->Call();
-
- # User wants the icon hidden
-
- if ( $event == 3 ) {
- $self->config_( 'trayicon', 0 );
-
- $self->{hideicon__} = Win32::API->new( "Platform/POPFileIcon.dll", "HideIcon", "", "N" );
- $self->{hideicon__}->Call();
- undef $self->{hideicon__};
-
- return 1;
- }
-
- # Double click icon, or select Open option in menu results in
- # navigating to the UI
-
- if ( $event == 2 ) {
-
- my $execute = Win32::API->new( "Shell32", "ShellExecute", "NPPPPN", "N" );
-
- # Get the port that the UI is running on and then use the
- # windows start function to start the browser running
-
- my $url = 'http://127.0.0.1:' . $self->module_config_( 'html', 'port' );
-
- if ( defined( $execute ) ) {
- $execute->Call( 0, "open", $url, "", "", 0 );
- } else {
- system( "start $url" );
- }
- }
-
- # Exit action from try context menu - return 0, to cause exit
-
- if ( $event == 1 ) {
- return 0;
- }
-
- return 1;
}
--- 142,145 ----
|