>>>From a button on a form I RUN another Windows program which downloads a text file from a barcode reader(via serial port).
>>>
>>>I don't want my code to continue running until the barcode program finishes.
>>>
>>>How can I recognise this completion?
>>>
>>>TIA
>>>Andrew McGurk
>>
>>See file #
9477 in the download section.
>>
>>Dan
>
>Thank you for your quick and appropriate response. It looks straight forward, but in my ignorance, it doesn't work for me!
>
>I am setting the following properties
>
> ThisForm.oProcess.icCommandline = 'tsr-tu3A.exe'
> ThisForm.oProcess.icLaunchDir = "C:\TsrTu3a"
> ThisForm.oProcess.icWindowMode = "NOR"
>
>and getting a NULL response = "Can't do it". I have stepped it through to the CrPr statement, then...
>
I assume that you then invoke LaunchAppAndWait().
Did you look at the icErrorMessage property after receiving the NULL back?
This is a SWAG, but if this is a DOS TSR, then it returns and leaves a stub running in the VDM, but the VDM shuts down at that point, so it won't do what you want. I'd try launching it with LaunchApp() and then polling the termination code with CheckProcessExitCode() to see what's happening if icErrorMessage doesn't give a description of the error.
Until you invoke one of the two LaunchApp methods, the app doesn't actually run; the NULL state for the hProcess indicates that no successful invocation took place. If it launched and failed to invoke, some value should return through icErrorMessage (at least that's how I wrote it...)