sub myjob2 { Win32::Process::Create(my $ProcessObj, "C:\\windows\\system32\\notepad.exe", "notepad noname.txt", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); my $exitcode; $mw->update () while $ProcessObj->GetExitCode($exitcode), $exitcode == 259; print $exitcode; }