GetFolder


The GetFolder method retrieves name of the special folder of the operating system.
C++
long GetFolder(
  long Folder,                       // folder specification
  LPSTR FolderName,                  // buffer that receives folder name
  long FolderLength                  // size of buffer
);
long GetFolder(
  long Folder,                       // folder specification
  LPWSTR FolderName,                 // buffer that receives folder name
  long FolderLength                  // size of buffer
);
BASIC
GetFolder(
  Folder As FolderType               // folder specification
) As String

Parameters

Folder
Folder specification, must be one of the following values:

IXF_FOLDER_WINDOWS Windows root folder,
IXF_FOLDER_SYSTEM Windows system folder,
IXF_FOLDER_TEMP temporary folder,
IXF_FOLDER_CURRENT current folder,
IXF_FOLDER_EXEC application folder.
C++
FolderName
Pointer to buffer that receives folder name.
Buffer must be large enough to accept at most FolderLength + 1 characters.
FolderLength
Size of buffer; if folder name is longer than FolderLength, error is returned.

Return Values

C++
If the method succeeds, the return value is the number of characters returned to the user, not including terminating NULL.
If the method fails, the return value is failure code and error code is set. Call GetError to get error code.
BASIC
If the method succeeds, the return value is a String containing name of the folder.
If the method fails, the return value is NULL and failure code and error code are set.

Remarks

IXF_FOLDER_EXEC specifies folder where executable module of the application that called this method is located.

Unicode version of the method should not be confused with Unicode system calls or Unicode text data. All versions of the method can be used on Unicode and non-Unicode systems depending on your needs. On Unicode systems, however, folder name is retrieved with Unicode version of system function (unless Unicode is disabled with EnableUnicode method). Conversion between ANSI and Unicode is performed internally according to current codepage which can be changed with SetCodePage method. See Unicode Support for more information on Unicode system calls, Unicode methods and Unicode text data.

See Also

File System Operations