Back

Tip 4. Running an External Program and Waiting for it to Complete.

We had a requirement for a synchronous Run command in Powerbuilder.

Our usual approach when trying to do things like this which Powerbuilder
doesn't easily allow you to do is to write a C function, build it into a
DLL, and then call the function from Powerbuilder as an external function.
This has proved successful because writing such functions is usually
easier in C because of C's rich system function library and because all
that is required in Powerbuilder to use the function is an external function
declaration.

Download the DLL runwait.zip (10K)

Copy the DLL to your Powerbuilder app's working directory. Declare the following
(either global or local) external function:

  FUNCTION uint RunWait(string command, uint style) LIBRARY "runwait.dll"

and insert calls to the function in your Powerbuilder app where required,
using any of the following values for style:

0 hidden
1 normal
2 minimised
3 maximised

     RunWait("notepad c:\release_notes.txt", 3)

Written and submitted by Stuart Dalby ([email protected])

Added before 01 Jan 2000

Back