GetSpecialFolder

Description

Retrieves the name of a localized folder.

Syntax

String GetSpecialFolder ( id_as_integer )

Argument

Description

id_as_integer

Integer that corresponds to a localized system folder name on the desktop, or on a device or emulator. Table 10-5 in the Usage section displays the correlation between integer values and folder names.

Returns

String. Returns the name of the folder on a localized operating system.

Usage

Operating systems using different languages can have different names for system folders. The GetSpecialFolder system function provides a means of obtaining the name of a system folder on a specific desktop machine or Windows CE device. This enables you to develop applications that access system folders and can still be deployed to devices using different language operating systems.

You use the integer parameter of GetSpecialFolder to indicate the name of the system folder that you want to return. The userName variable in Table 10-5 depends on the login name of the current user.

Table 10-5: Correspondence of parameter value to folder name

Value

Desktop folder

Pocket PC folder

Smartphone folder

0

C:\Documents and Settings\userName\Desktop

\My Documents

2

C:\Documents and Settings\userName\Start Menu\Programs

\Windows\Start Menu\Programs

5

C:\Documents and Settings\userName\My Documents

\My Documents

\Storage\My Documents

6

C:\Documents and Settings\userName\Favorites

\Windows\Favorites

\Storage\Windows\Favorites

7

C:\Documents and Settings\userName\Start Menu\Programs\Startup

\Windows\Startup

\Storage\Windows\Startup

11

C:\Documents and Settings\userName\Start Menu

\Windows\Start Menu

\Storage\Windows\Start Menu

20

C:\WINNT\Fonts

\Windows\Fonts

\Storage\Windows\Fonts

26

C:\Documents and Settings\userName\Application Data

\Storage\Application Data

36

C:\WINNT\

Pocket PC 2002:  — Pocket PC 2003 and later:    \Windows

\Storage\Windows

38

C:\Program Files

\Program Files

\Storage\Program Files

Examples

Example 1

The following example returns the name of the localized folder that corresponds to the \Windows\StartMenu\Programs folder on an English language Pocket PC device or emulator. For a German language Pocket PC device, the return value would be \Windows\Startmenü\Programme:

String ls_Folder

ls_Folder = GetSpecialFolder(2)