Consultor Eletrônico



Kbase P23813: How to locate and launch an application from within 4GL using ShellExecute on Windows OS
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   6/12/2008
Status: Verified

GOAL:

How to locate and launch an application from within 4GL

GOAL:

Using ShellExecute to launch application from within Progress

FACT(s) (Environment):

Windows

FIX:

The following code will use the Windows function ShellExecuteA within the SHELL32.DLL.

DEFINE VARIABLE vExe AS CHARACTER NO-UNDO.
DEFINE VARIABLE hInstance AS INTEGER.

DEF BUTTON b-ok.
FORM b-ok WITH FRAME zz.


ON CHOOSE OF b-ok DO:
vExe = SEARCH ("prowin32.exe").

RUN ShellExecuteA(0, "open", vExe, "", "", 0, OUTPUT hInstance).
END.

UPDATE b-ok WITH FRAME zz.


PROCEDURE ShellExecuteA EXTERNAL "shell32.dll":
DEFINE INPUT PARAMETER hwnd AS LONG.
/* Handle to parent window */
DEFINE INPUT PARAMETER lpOperation AS CHAR.
/* Operation to perform: open, print */
DEFINE INPUT PARAMETER lpFile AS CHAR.
/* Document or executable name */
DEFINE INPUT PARAMETER lpParameters AS CHAR.
/* Command line parameters to executable in lpFile */
DEFINE INPUT PARAMETER lpDirectory AS CHAR.
/* Default directory */
DEFINE INPUT PARAMETER nShowCmd AS LONG.
/* whether shown when opened:
0 hidden, 1 normal, minimized 2, maximized 3,
0 if lpFile is a document */
DEFINE RETURN PARAMETER hInstance AS LONG.
/* Less than or equal to 32 */

END.