rpnoble wrote:
> How can i detect a 2nd launch of my application, popup an error message and
> then exit?
>   
Here's a sample of how to use a mutex. A mutex is better than Ilyn's 
example if your wondows title may change (if you change the title to 
show the currently open document, status, etc.)

use strict;
use warnings;

use Win32::Mutex;

# Create or open the mutex
my $mutex = Win32::Mutex->new(1, "Mutex Test");

# Die if the mutex exists (183 == ERROR_ALREADY_EXISTS)
die "App is already running" if $^E == 183;

# Do something here
print "Sleeping...\n";
sleep(30);

# We're done, release the mutex
$mutex->release;

-- 
Brian, Tommy, Helen and Paka -- [EMAIL PROTECTED]
This message traveled at least 44,000 miles to reach you!



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 080615-0, 06/15/2008
Tested on: 6/15/2008 10:10:48 AM
avast! is copyright (c) 2000-2008 ALWIL Software.
http://www.avast.com




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
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