Page 1 of 1

[Implemented] "Exit-Code"-Output for Runprogram

Posted: Fri Jun 03, 2005 5:00 am
by Hroudtwolf
Dear Fred,

Is it possible to make an "Exit-Code"-Output for the RunProgram command.
I think its really important.
I needed that very often.
Also, this function exists in many other languages.

best regards

Hroudtwolf

Posted: Fri Jun 03, 2005 6:57 am
by Bonne_den_kule
End exitcode

Posted: Fri Jun 03, 2005 7:14 am
by Max.
Bonne_den_kule wrote:
End exitcode
I understood Hroudtwolf's problem differently; not the exit code of his program is meant, but he exit code of an external app, invoked from his program with the RunProgram parameter.

Just in case a replacement, I am now using

Code: Select all

  ei.SHELLEXECUTEINFO
  ei\cbSize = SizeOf(SHELLEXECUTEINFO) 
  ei\fMask = #SEE_MASK_FLAG_DDEWAIT | #SEE_MASK_NOCLOSEPROCESS 
  ei\nShow = #SW_HID
    
  ei\lpVerb = @"open"
  ei\lpFile = @Command.s
  ei\lpParameters = @Parameters.s
  ei\lpDirectory = @Path.s
            
  Result = ShellExecuteEx_(@ei) 
            
  If Result
    For i = 1  To 300 
    ´  Delay(1000)  ;check for 300*1000ms if ShellExecute is done
       If GetExitCodeProcess_(ei\hprocess, @ExitCode) 
         If ExitCode <> #STILL_ACTIVE 
           Break 
         EndIf 
       EndIf 
    Next 
              
    If ExitCode<>#STILL_ACTIVE 
      Debug Str(ExitCode) ;Exit code of external app
    Else
  ´   Debug "Timeout" ;ShellExecute still not finished
    EndIf        
  EndIf

Posted: Fri Jun 03, 2005 7:49 am
by Hroudtwolf
@Max

Yes . It is it.

I know this complex API-catastrophe.
But this must be implemented in a normal programming languages.

Posted: Fri Jun 03, 2005 1:35 pm
by Bonne_den_kule
Sorry