pipe(FROM_P, TO_C) or die "pipe: $!"; select(((select(TO_C), $| = 1))[0]); if (!(my $pid = fork)){ close(TO_C); #close(FROM_C); my $running = 1; while(my $line = ) { Win32::GUI::MessageBox(0,"Child Pid $$ just read this: $line","GMS Alert"); chomp($line) if($line =~ m/\n$/o); if(lc($line) eq 'exit'){ Win32::GUI::MessageBox(0,"Exit","GMS"); sleep(20); #To allow time to read the MessageBox... if it ever comes up... exit; } } } #### sub GMSMain_Terminate { defined(my $win = $Win32::GUI::Loft::window{GMSMain}) or return(1); print TO_C 'exit'; return(-1); } sub mnuFileExit_Click { defined(my $win = $Win32::GUI::Loft::window{GMSMain}) or return(1); print TO_C 'exit'; return(-1); }