Consultor Eletrônico



Kbase P9223: How to change the current working directory of a 4GL session on Windows?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/01/2009
Status: Verified

GOAL:

How to change the current working directory of a 4GL session on Windows?

GOAL:

How to set the current working directory using 4GL at run time?

GOAL:

How to modify the current working directory of the Progress/OpenEdge 4GL/ABL session?

GOAL:

How to Call WIN32 API Function: SetCurrentDirectory

FACT(s) (Environment):

Windows
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

The following shows how to invoke the Win32 API SetCurrentDirectoryA Function to change the current Working Directory of the 4GL/ABL session to: "C:\OpenEdge\WRK101B":

DEFINE VARIABLE iResult AS INTEGER NO-UNDO.
RUN SetCurrentDirectoryA (INPUT "C:\OpenEdge\WRK101B", OUTPUT iResult).
IF iResult = 1 THEN MESSAGE "Current directory has been changed" VIEW-AS ALERT-BOX.
ELSE MESSAGE "Directory does not exist, or access is denied" VIEW-AS ALERT-BOX.
/* Define the entry point for the external DLL function */
PROCEDURE SetCurrentDirectoryA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER chrCurDir AS CHARACTER.
DEFINE RETURN PARAMETER iResult AS LONG.
END PROCEDURE.