다음을 통해 공유


SHGetSpecialFolderPath (Windows CE 5.0)

Send Feedback

This function retrieves the path of a special folder, identified by its CSIDL.

Syntax

BOOL SHGetSpecialFolderPath(HWND hwndOwner,LPTSTR lpszPath,int nFolder,BOOL fCreate);

Parameters

  • hwndOwner
    [in] Handle to the owner window the client should specify if it displays a dialog box or message box.
  • lpszPath
    [in] Address of a character buffer that receives the drive and path of the specified folder. This buffer must be at least MAX_PATH characters in size.
  • nFolder
    [in] CSIDL that identifies the folder of interest. If a virtual folder is specified, this function fails. See SHGetSpecialFolderLocationRemarks for a list of valid CSIDL values.
  • fCreate
    [in] Indicates whether the folder should be created if it does not already exist. If this value is nonzero, the folder is created. If this value is zero, the folder is not created.

Return Values

In the standard shell, this function returns TRUE if it is successful and FALSE if it fails.

If you are using the AYGShell extensions, then this function returns FALSE even if successful. If the folder represented by the CSIDL does not exist and is not created, a NULL string is returned indicating that the directory does not exist.

**Note   **For Windows Mobile 2003 and later, returns TRUE if successful, FALSE otherwise. For Pocket PC 2002 and Smartphone 2002 and earlier, returns FALSE even if successful. If the folder represented by the nFolder parameter does not exist and is not created, a NULL string is returned indicating that the directory does not exist.

Remarks

A number of folders are used frequently by applications, but may not have the same name or location on any given system. CSIDL values provide a unique system-independent way to identify these special folders. The values supersede the use of environment variables for this purpose. A CSIDL is used in conjunction with the shell function SHGetSpecialFolderLocation to retrieve a special folder's path name or item ID list (PIDL). See SHGetSpecialFolderLocation for a list of valid CSIDL values.

Windows Mobile Remarks

The following table lists valid CSIDL values for the nFolder parameter:

CSIDL Value Description
CSIDL_APPDATA 0x001A File system directory that serves as a common repository for application-specific data.
CSIDL_DESKTOP 0x0000 Not supported on Smartphone.
CSIDL_DESKTOPDIRECTORY 0x0010 File system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself).
CSIDL_FAVORITES 0x0006 The file system directory that serves as a common repository for the user's favorite items.
CSIDL_FONTS 0x0014 The virtual folder that contains fonts.
CSIDL_MYMUSIC 0x000d Folder that contains music files.
CSIDL_MYPICTURES 0x0027 Folder that contains picture files.
CSIDL_MYVIDEO 0x000e Folder that contains video files.
CSIDL_PERSONAL 0x0005 The file system directory that serves as a common repository for documents.
CSIDL_PROFILE 0x0028 Folder that contains the profile of the user.
CSIDL_PROGRAM_FILES 0x0026 The program files folder.
CSIDL_PROGRAMS 0x0002 The file system directory that contains the user's program groups, which are also file system directories.
CSIDL_RECENT 0x0008 File system directory that contains the user's most recently used documents.
CSIDL_STARTUP 0x0007 The file system directory that corresponds to the user's Startup program group. The system starts these programs when a device is powered on.
CSIDL_WINDOWS 0x0024 The Windows folder.

The CSIDL_DESKTOP value is invalid for the Smartphone platform. Smartphone uses a home screen instead of a desktop; do not use this CSIDL value within the Smartphone development environment.

Requirements

Pocket PC: Pocket PC 2000 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: shellapi.h
Library: coredll.lib

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.