Consultor Eletrônico



Kbase P95029: How to get Windows Installation Directory in 4GL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

GOAL:

How to get Windows Installation Directory in 4GL ?

FACT(s) (Environment):

Windows NT 32 Intel/Windows 2000

FIX:

This can be achieved using GetWindowsDirectoryA Windows API.

DEFINE VARIABLE cWindir AS CHARACTER NO-UNDO.
DEFINE VARIABLE cWindowsDir AS CHARACTER NO-UNDO.
DEFINE VARIABLE iOutsize AS INTEGER NO-UNDO.
PROCEDURE GetWindowsDirectoryA EXTERNAL "kernel32" :
DEFINE OUTPUT PARAMETER lpBuffer AS CHAR.
DEFINE INPUT PARAMETER uSize AS LONG.
DEFINE RETURN PARAMETER uRet AS LONG.
END PROCEDURE.


cWindir = FILL("x", 260).
RUN GetWindowsDirectoryA (OUTPUT cWindir,
LENGTH(cWindir),
OUTPUT iOutsize).
ASSIGN cWindowsdir = SUBSTRING(cWindir,1,iOutsize).
MESSAGE cWindowsdir
VIEW-AS ALERT-BOX INFO BUTTONS OK.