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

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

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

Post 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
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

End exitcode
Max.
Enthusiast
Enthusiast
Posts: 225
Joined: Fri Apr 25, 2003 8:39 pm

Post 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
Athlon64 3800+ · 1 GB RAM · Radeon X800 XL · Win XP Prof/SP1+IE6.0/Firefox · PB 3.94/4.0
Intel Centrino 1.4 MHz · 1.5 GB RAM · Radeon 9000 Mobility · Win XP Prof/SP2+IE6.0/Firefox · PB 3.94/4.0
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

@Max

Yes . It is it.

I know this complex API-catastrophe.
But this must be implemented in a normal programming languages.
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

Sorry
Post Reply