How to obtain return value of a called exe?

Post Reply
hua
Posts: 1077
Joined: Fri Oct 28, 2005 2:27 am
Has thanked: 1 time
Been thanked: 1 time

How to obtain return value of a called exe?

Post by hua »

Hi guys,
If exe A calls exe B, using winexec() or waitrun(), how to get the value returned by exe B?

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: How to obtain return value of a called exe?

Post by nageswaragunupudi »

WaitRun() is expected to return the exitcode of executed exe.
But somehow I could not get reliable results.
You may try testing it.
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 1077
Joined: Fri Oct 28, 2005 2:27 am
Has thanked: 1 time
Been thanked: 1 time

Re: How to obtain return value of a called exe?

Post by hua »

Thanks for the reply Rao.

I didn't manage to get it too and when I check the documentation it says waitrun() returns hInstance.

So I just wrote a workaround by having exe B dumped the return value in a file for exe A to read. It serve the purpose but not as neat as having exe A reading directly exe B's return value.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: How to obtain return value of a called exe?

Post by nageswaragunupudi »

Returns hInstance when __FLAT__ is not defined.
FWH is compiled with __FLAT__ defined.
The function should return ExitCode

Code: Select all | Expand

        hb_retnl( dwExitCode );
 


Mr Antonio can explain better.
So I just wrote a workaround by having exe B dumped the return value in a file for exe A to read

This is the best thing to do.
Regards

G. N. Rao.
Hyderabad, India
hmpaquito
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: How to obtain return value of a called exe?

Post by hmpaquito »

To communicate two exes programs. Send parameters or returns information:

- You can use aRead() and aSave() functions.
- Or better FW_ValToExp() funcion with memowrit() and & operator with memoread().
hua
Posts: 1077
Joined: Fri Oct 28, 2005 2:27 am
Has thanked: 1 time
Been thanked: 1 time

Re: How to obtain return value of a called exe?

Post by hua »

Thanks for the input Paco
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
antolin
Posts: 498
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla

Re: How to obtain return value of a called exe?

Post by antolin »

You can try INI files too
Peaaaaaso de foro...
FWH 2007 - xHarbour - BCC55
hua
Posts: 1077
Joined: Fri Oct 28, 2005 2:27 am
Has thanked: 1 time
Been thanked: 1 time

Re: How to obtain return value of a called exe?

Post by hua »

Thanks for the input Antolin. I do use ini file quite a lot.

Speaking of ini file, I find it annoying that it doesn't leave a blank space in between sections. It makes it hard to read and edit manually
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
Post Reply