|
Question |
I am interested in launching the CPROGxx command-line flash programmer from my own application, and reading the resultant error code. Is there some simple way to do this from a Windows based application? |
|
Answer |
The Microsoft WIN32 API has several calls which allow you to launch an application(CreateProcess), check it's status (GetExitCodeprocess) until it completes, and then read back the resulting error code(GetExitCodeprocess). An error code of zero indicates successful programming. An example written in Delphi is shown as follows, and a similar approach can be used from Microsoft Visual C and any other development language which has access to the WIN32 API.
To launch the application:
with dummystartup do
begin
cb := sizeof(TstartupInfo);
lpreserved := NIL;
lpDesktop := NIL;
lpTitle := NIL;
dwFlags := 0;
cbReserved2 := 0;
lpReserved2 := NIL;
end;
CreateProcess(NIL,@path,NIL,NIL,FALSE,CREATE_SEPARATE_WOW_VDM,NIL,NIL,dummystartup,currentProcess);
To check the status and error code:
Repeat
Application.ProcessMessages;
GetExitCodeprocess(currentprocess.hprocess, theExitCode);
until Application.Terminated or (theexitcode<>STILL_ACTIVE);
|
|
Related Downloads |
none
|
|
Architectures |
Categories |
Products |
HC08, HCS08, HC(S)12(X), 68HC16, CPU3xx, ColdFire V2/V3/V4, Power MPC5xx/8xx, Qorivva MPC5xxx, RS08, ColdFire V1, Kinetis / S32, DSC, S12Z, LPC, STM32, SPC5, STM8, i.MX, ARM-based |
Flash Programming Software |
CPROG08SZ, PROGHCS08, PROG12Z, PROG16Z, PROG32Z, PROGCFZ, PROGMCZ, PROGPPCZ, PROGRS08, CYCLONE_MAX_REPLACE, UNIT12Z-LINUX-DIST, DEMO9S08QE8, XPC563MADPT144S, XPC563MADPT208S |
|
|
Please
rate this FAQ to help us improve our support
0 means "not helpful"
10 means "very helpful" |
|
|
|
|