Hi,

Perhaps you could try:

my $instance = Wx::SingleInstanceChecker->new();
$instance->Create('A_Special_Name_Here');
exit if $instance->IsAnotherRunning();

Best Regards,
bungsu

On Wed, 2008-08-27 at 00:01 +0300, Octavian Rasnita wrote:
> Hi,
> 
> I have a program made with WxPerl which has the main window hidden and which 
> can be shown using a tray icon.
> 
> I want to avoid opening that program twice, so after opening it, I want to 
> test if the program is already opened, and if it is, I want to show its 
> hidden main window and if it is possible to set the focus to a certain 
> object.
> 
> I use File::Pid for testing if the program is already open, but I don't know 
> how to switch to the process with a certain PID and I also don't know how to 
> unhide a Wx frame from another process.
> 
> Can you give me some hints?
> 
> I think I would need to send a certain signal to that process using kill() 
> and handle that signal using $SIG{} and do what I want then.
> But I don't know what signal to use for things like these.
> 
> I have tried to trap signals like HUP and others, but they all kill the 
> running program.
> 
> Octavian
> 

Reply via email to