winshellexec() and winshellexecwait()

This page describes one of the supplementary ways of running an application.

The main way to run an application is the RUN statement.

winshellexec() and winshellexecwait() are used to open documents on the client PC. These functions are similar to winexec() and winexecwait(). The key difference is that they are executed via a system shell.  This can be especially useful on Windows, as it allows an automatic document opening:

CALL winshellexec("c:\\program files\\querix\\hydra\\progs\\myfile.pdf")

Is equivalent to:

CALL winexec("explorer c:\\program files\\querix\\hydra\\progs\\myfile.pdf")

Here is the code snippet illustrating how the functions can be used within the 4GL code:

MAIN

  DEFINE file_name VARCHAR(200)

 

  OPEN WINDOW win

    AT 1,1

    WITH 24 ROWS , 80 Columns

 

  LET file_name = fgl_getenv("QUERIXDIR")

  DISPLAY "QUERIXDIR =", file_name AT 5,5

 

  LET file_name = file_name CLIPPED, "/documentation/Multiple_Database_Usage.pdf"

  DISPLAY "Multi Database Manual is located in:" AT 6,5

  DISPLAY file_name AT 7,5

 

  CALL winshellexec(file_name)

  CALL fgl_winmessage("End","WinExec() Demo Application - Press OK to close demo application","info")

END MAIN

If the argument for winshellexec() and winshellexec() does not contain an absolute path to a file, then the file will be searched here:

  1. Current directory which is equivalent to the %LYCIA_DIR% environment variable value if the program is launched from LyciaStudio
  2. Current directory which is equivalent to the %LYCIA_DIR%/client/www if the program launched by LyciaDesktop, and LyciaDesktop was installed as a component of LyciaStudio
  3. Current directory which is equivalent to the location of the LyciaDesktop executable (default is C:\Program Files\Querix\Querix LyciaDesktop) if LyciaDesktop was installed as a stand-alone client.
  4. Directories defined in the %PATH% environment variable on the client side.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.