Consultor Eletrônico



Kbase P23344: How to launch the associated application of a file from with
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/06/2008
Status: Unverified

GOAL:

How to launch the associated application of a file 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 hInstance AS INTEGER.

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

ON CHOOSE OF b-ok DO:
  RUN ShellExecuteA(0, "open", "http://www.progress.com/", "", "", 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.