You are here: Home -> Powerbuilder
 

Powerbuilder

I have written a few routines which visitors are free to use as they want (However please do not publish on other websites - please link to this page). They are described below and can be downloaded from this page.

All routines were developed using Powerbuilder 5.0 and tested on Windows 95, 98 and NT version 4 operating systems. However, there should not be any problem calling these routines with later versions of Powerbuilder, other development environments and later versions of operating system.

Please contact me if you have any comments, questions or suggestions relating to these routines.

Run DLL Back to Top

This is a self-contained Windows DLL which contains a single function called Run which can be accessed from within a standard Powerbuilder application via either a local or global external function call. e.g.

Powerbuilder external function declaration:
FUNCTION long Run(string command, long winstate) &
LIBRARY "run.dll"

Instantiation:
Integer li_retval
li_retval = Run("notepad c:\autoexec.bat", 0) // 0 = Hidden

Purpose

Similar to Powerbuilder's own Run function, this function provides greater flexibility over the window state of the initiated program. Additional window states include Hidden, Shown but without being activated and Minimised but not activated. The definitive list of window states is shown below:

WindowState Parameter Window State
0 Hidden
1 Normal
2 Minimised
3 Maximised
4 Shown but not as active window
7 Shown Minimised but not as active window

Return Value

Returns 1 when the specified command has terminated. Returns -1 if it is unable to run the specified command.

Click here to download run.dll

RunWait DLL Back to Top

Similiar to the enhanced Run DLL described above, this DLL contains a single function called RunWait which, when called, waits until the specified command completes before passing back its return value. e.g.

Powerbuilder external function declaration:
FUNCTION long RunWait(string command, long winstate) &
LIBRARY "runwait.dll"

Instantiation:
Integer li_retval
li_retval = RunWait("c:\backup.bat", 1) // 1 = Normal

Return Value

Returns the return value from the specified command. Returns -1 if it is unable to run the specified command.

Click here to download runwait.dll

Notes Back to Top

If you get a "Bad runtime function reference" error at the point of calling either the Run or RunWait function, the most likley cause is that Powerbuilder has failed to locate the run.dll or runwait.dll file respectively.

Please ensure that the appropiate DLL file is located either in the same directory as your application, or in a directory mentioned in your PC's PATH environment variable.

Please contact me if you continue to experience difficulties.

 
 
No comments. Why not be the first to add one?
 
You need to log in/register to post a comment.
 
< Home > Back to Top