Kbase 17390: How to Call WIN32 API Function: GetTempPath
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
How to Call WIN32 API Function: GetTempPath
DISCLAIMER:
===========
The code example in this knowledgebase is for informational purposes
only. If you have specific questions about which API calls would be
best suited to your design goals, please consult your Microsoft
documentation.
INTRODUCTION:
=============
The following sample code shows how to call the Win32 API function
called GetTempPath. This function retrieves the path of the directory
designated for temporary files. This is the path that should be used
for temporary files.
This code has been tested on Windows NT 4.0 Workstation only.
DEFINE VARIABLE chrBuffer AS CHARACTER NO-UNDO FORMAT "X(128)".
DEFINE VARIABLE intRC AS INTEGER NO-UNDO.
ASSIGN chrBuffer = FILL(' ',128).
RUN GetTempPathA(128, OUTPUT chrBuffer, OUTPUT intRC).
IF intRc = 0 THEN
MESSAGE "Function Call Failed" VIEW-AS ASLERT-BOX.
ELSE
IF intRC <= 128 THEN
MESSAGE chrBuffer VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Buffer must be " + STRING(intRC) + " bytes"
VIEW-AS ALERT-BOX.
PROCEDURE GetTempPathA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER intSize AS LONG.
DEFINE OUTPUT PARAMETER chrBuffer AS CHARACTER.
DEFINE RETURN PARAMETER intRC AS LONG.
END PROCEDURE.
Progress Software Technical Support Note # 17390