1. mukul pandey
  2. PowerBuilder
  3. Tuesday, 06 August 2019

Hi Everyone,

I am using PowerBuilder 2017 R2. I want to run an another application which is written in C# in my powerbuilder windows application. Want to click on a button with 2 string input parameter and also need to get the return value of the application.

I tried below code but its not working:-

string ls_1, ls_2
ls_1="abc"
ls_2=""
run("PMFC.exe "+ls_1+" "+ls_2+")

Please suggest.

 

Thanks,

Mukul

Accepted Answer
Marco Meoni Accepted Answer Pending Moderation
1
Votes
Undo

Hi Mukul,

Run() won't help you with Exitcode handling of external apps, you need a Run&Wait API.

Google for "run and wait powerbuilder" or "CreateProcess powerbuilder" to get some examples.

Here 2 links you can start from:

https://answers.sap.com/questions/11629053/run-and-wait.htm

http://www.topwizprogramming.com/freecode_runandwait.html

Best,

.ml

Comment
Hi Marco,

Thanks for info. It is good for me but i also need to get the return value of that application. Please suggest.



Thanks

Mukul
  1. mukul pandey
  2. Tuesday, 6 August 2019
A program can only return a number 'the return code'. Anything other than that would have to be saved somewhere that the caller can read once the external app is finished.
  1. Roland Smith
  2. Tuesday, 6 August 2019
thanks
  1. mukul pandey
  2. Tuesday, 13 August 2019
There are no comments made yet.
  1. Tuesday, 6 August 2019
  2. PowerBuilder
  3. # Permalink
Roland Smith Accepted Answer Pending Moderation
2
Votes
Undo

The built in Run function doesn't wait for the external app to complete, it immediately goes to the next line of code.

I have a Run And Wait code example you can try:

http://www.topwizprogramming.com/freecode_runandwait.html

It allows for getting the return code from the external app. If you want to return more detailed info, you can put it in the database or in a file to be read by the caller.

 

Comment
There are no comments made yet.
  1. Tuesday, 6 August 2019
  2. PowerBuilder
  3. # 1
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.