Managing Files and Folders

A standard folder is analogous to a directory in a file system. Each folder can contain files, additional folders, and other file system objects. These other file system objects include a set of special folders, which Windows CE handles differently from standard folders. An example of a special folder is the Programs folder, which contains a set of shortcuts displayed on the Start menu. Another example is Control Panel, a special folder that contains control panel applications.

These special folders are used frequently by applications, but may not have the same name or location on a specified device. To provide a unique, system-independent way to identify these special folders, each folder is assigned a CSIDL value.

To determine the path of a special folder, call the SHGetFolderPath function, which uses a folder's CSIDL to return the path name. The following code example shows the prototype for this function.

STDAPI SHGetFolderPath( HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPTSTR pszPath);

The first parameter is a handle to a window that owns any dialog box the shell needs to display during the processing of this function. The second parameter is the CSIDL value of the directory requested. The third parameter is a token that represents a particular user. This parameter must be NULL on Windows CE. The fourth parameter is reserved and must be set to 0, and the fifth parameter points to the buffer to receive the path. This buffer must be at least MAX_PATH characters in length.