Consultor Eletrônico



Kbase P87295: How to Call WIN32 API Function: SetCurrentDirectory
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/12/2005
Status: Unverified

GOAL:

How to Call WIN32 API Function: SetCurrentDirectory

GOAL:

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

FACT(s) (Environment):

Windows

FACT(s) (Environment):

Progress 8.x

FACT(s) (Environment):

Progress 9.x

FACT(s) (Environment):

OpenEdge 10.x

FIX:

The following sample code shows how to call the Win32 API function called SetCurrentDirectory. This function changes the current directory to the specified path.

DEFINE VARIABLE intResult AS INTEGER NO-UNDO.

PROCEDURE SetCurrentDirectoryA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER chrCurDir AS CHARACTER.
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.

RUN SetCurrentDirectoryA (INPUT "C:\TEMP", OUTPUT intResult).

IF intResult = 1 THEN
MESSAGE "Current Directory Has Been Changed" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Directory Does Not Exist" VIEW-AS ALERT-BOX.