we looked at the link below and created an API process and  we keep on 
getting an exitcode  return value that indicate that process get launched and 
ran successfully

we even hardcod  this line of code at the end of  TEST.EXE
   RETURN "XXX"


and return code would be always be returned based on the exitcode from this 
CreateProcess API that indicate whether or not the Process had  ran 
and finished successfully 

But the Actual  return code  from TEST.EXE  of "XXX"  was not returned

_________________________________________________________
DECLARE SHORT CreateProcess IN WIN32API AS CrPr ;
  STRING lpszModuleName, ;
  STRING @lpszCommandLine, ;
  STRING lpSecurityAttributesProcess, ;
  STRING lpSecurityAttributesThread, ;
  SHORT bInheritHandles, ;
  INTEGER dwCreateFlags, ;
  STRING lpvEnvironment, ;
  STRING lpszStartupDir, ;
  STRING @lpStartInfo, ;
  STRING @lpProcessInfo

** more code in here


lResult = CrPr( 0, ;
     cCommandLine, ;
     0, 0, 0, 0, 0, ;
     uFromDir, ;
   �...@cstartupinfo, ;
   �...@cprocessinfo)

lResult = CrPr( 0, ;
     cCommandLine, ;
     0, 0, 0, 0, 0, ;
     uFromDir, ;
   �...@cstartupinfo, ;
   �...@cprocessinfo)
 * Strip the handles from the PROCESS_INFORMATION structure and save in private 
properties
 
 
 IF lResult = 1
  .ParseProcessInfoStruc(cProcessInfo)
  RETURN .T.
 ELSE
  .icErrorMessage = 'Process Specified by icCommandLine could not be started'
  RETURN .F.
 ENDIF





________________________________
From: Stuart Dunkeld <[email protected]>
To: [email protected]
Sent: Thursday, July 2, 2009 12:56:22 PM
Subject: Re: How can you get a return code from VPF executable

Have a look at http://fox.wikis.com/wc.dll?Wiki~ExitCode - essentially
you need to call the WIn32API function ExitProcess with your return
code (which must be an integer) to end your VFP program.

Regards

--stuart

On Thu, Jul 2, 2009 at 6:44 PM, Jean Haidar<[email protected]> wrote:
> we have an VFP executable that return either .T.   if it run without errors 
> and return  .F.   in case of errors
>
> we have used tried many ways to check its return code.
>
> from VFP:
>
> strExe = "c:\batch_process\TEST.exe DATE()-35  DATE()"
> cretcode = loshell.Run(strExe,1,.t.)
>
>
> the cretcode is always returning 0 whether or not the VFP exe produce an 
> error or NOT.
>  we are inserting the error info into a table when TEST.Exe  produce an error
>
>
> we also tried this code from VB.NET
>
> Dim
> myProcess.EnableRaisingEvents = myProcess AsProcess = 
> NewProcess()TruemyProcess.StartInfo.FileName = 
> "C:\Jean_dev\Batch_process\TEST.exe"' ArgumentsmyProcess.StartInfo.Arguments 
> = " date()-35 date() "myProcess.StartInfo.RedirectStandardOutput = 
> TruemyProcess.StartInfo.UseShellExecute = FalsemyProcess.Start()' need to 
> wait until it is finishedDoWhilemyProcess.HasExited = False    Dimlctime = 
> NowLoopDimnexitcode = myProcess.ExitCodeDimoutput AsString= 
> myProcess.StandardOutput.ReadToEnd()
>
>
> nexitcode is always 0 and output is a blank string
>
>
> we are want to avoid writing a DLL and registering on the Server.
>
>
> Jean Haidar
> [email protected]
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
>  text/plain (text body -- kept)
>  text/html
> ---
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


Report [OT] Abuse: 
http://leafe.com/reportAbuse/[email protected]


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to