See http://www.latiumsoftware.com/en/delphi/00003.php

In particular notice:
   GetExitCodeProcess(proc_info.hProcess, ExitCode);


On Fri, Oct 9, 2009 at 8:00 AM, <delphi-requ...@elists.org> wrote:

> Date: Fri, 9 Oct 2009 00:57:36 -0700
> From: "John Dammeyer" <jo...@autoartisans.com>
> Subject: Captures information from a ShellExecute
> To: "'Borland's Delphi  Discussion List'" <delphi@elists.org>
> Message-ID: <004501ca48b6$2a866920$6801a...@asus>
> Content-Type: text/plain;       charset="us-ascii"
>
> Hi,
>
> I'm launching a windows command line PIC programmer as follows:
>
>    res := ShellExecute(Self.Handle, nil, 'pk2cmd.exe', '/PPIC18F2680
> /FTricolourNode.hex /M /A5.00',
>    'C:\Firmware', SW_SHOWNORMAL);
>
> The shell executes and returns immediately as it probably should.  The
> Command Line window stays open until the pktcmd.exe finishes.  Once the
> pk2cmd.exe finishes it closes the window immediately.  If it's failed to
> program th PIC microntroller I don't see the information before the window
> closes.
>
> If I use CreateProcess I can then hang around until the app is done but
> then it's the same issue.  The Command Window closes when the app closes
> and I can't seem to catch an error code from the pk2cmd.exe as outlined
> below:
>
> 11. Return Codes
> --------------------------------------------------------------------------
> --
> Value   Code                    Notes
> -----   ----                    -----
> 0       OPSUCCESS               Returned if all selected operations
> complete
>                                successfully.
> 5       VOLTAGE_ERROR           A Vdd and/or Vpp voltage error was
> detected.
>                                This could be due to PICkit 2 being
>                                improperly connected to a part, incorrect
>                                part selection, or interference from other
>                                circuitry on the target board.
> ...
>
> 39      AUTODETECT_FAILED       A part autodetect operation failed to find
>                                a known part.
>
> Is there a way to lauch a window and capture the return code of the
> application as opposed to the success or failure of launching the command
> line window?
>
> GetLastError just returns 0.
>
> I've tried >>results.txt with no luck to try and catch the text output.
>
> Googling on this subject seems to always refer to the Windows Error Code
> which GetLastError would return.
>
> Thanks
>
> John
>
>
> Automation Artisans Inc.
> http://www.autoartisans.com/ELS/
> Ph. 1 250 544 4950
>
>
_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to