Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service
   Home P&E Customer Support FAQs - Frequently Asked Questions FAQ ID # 28
FAQ ID # 28
 
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
Flash Programming Software CPROG08SZ, PROGHCS08, PROG12Z, PROG16Z, PROG32Z, PROGCFZ, PROGMCZ, PROGPPCZ, PROGRS08, CYCLONE_MAX_REPLACE, UNIT12Z-LINUX-DIST, DEMO9S08QE8
 
Please rate this FAQ to help us improve our support
0 means "not helpful"
10 means "very helpful"
0 1 2 3 4 5 6 7 8 9 10

© 2017 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement