[파워빌더] Determine the TEMP directory designated for temporary files.
In PB6, simply get the value of the environment variable TEMPContextKeyword lcxk_base
string ls_temp[]
this.GetContextService("Keyword", lcxk_base)
lcxk_base.getContextKeywords("TEMP", ls_temp)
RETURN ls_temp[1]
Or you can use the following API call[External function declaration]
FUNCTION ulong GetTempPath(ulong nBufferLength, ref string lpBuffer) &
LIBRARY "kernel32" ALIAS FOR GetTempPathA
[powerscript]
long ll_bufferlength = 256
string ls_tempDir
ls_tempDir = SPACE(ll_bufferLength)
IF GetTempPath(ll_bufferLength, ls_tempDir) = 0 THEN
MessageBox("Temp dir", "not defined")
ELSE
MessageBox("Temp dir", ls_tempDir)
END IF
The GetTempPath function gets the temporary file path as follows:The path specified by the TMP environment variable.
The path specified by the TEMP environment variable, if TMP is not defined.
The current directory, if both TMP and TEMP are not defined.
string ls_temp[]
this.GetContextService("Keyword", lcxk_base)
lcxk_base.getContextKeywords("TEMP", ls_temp)
RETURN ls_temp[1]
Or you can use the following API call[External function declaration]
FUNCTION ulong GetTempPath(ulong nBufferLength, ref string lpBuffer) &
LIBRARY "kernel32" ALIAS FOR GetTempPathA
[powerscript]
long ll_bufferlength = 256
string ls_tempDir
ls_tempDir = SPACE(ll_bufferLength)
IF GetTempPath(ll_bufferLength, ls_tempDir) = 0 THEN
MessageBox("Temp dir", "not defined")
ELSE
MessageBox("Temp dir", ls_tempDir)
END IF
The GetTempPath function gets the temporary file path as follows:The path specified by the TMP environment variable.
The path specified by the TEMP environment variable, if TMP is not defined.
The current directory, if both TMP and TEMP are not defined.