SHGetSpecialFolderPath 和 CSIDLf

Syntax

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

Parameters

hwndOwner
Handle to the owner window the client should specify if it displays a dialog box or message box.
lpszPath
Pointer to a null-terminated string that receives the drive and path of the specified folder. This buffer must be at least MAX_PATH characters in size.
nFolder
A CSIDL that identifies the folder of interest. If a virtual folder is specified, this function will fail.
fCreate
Indicates if the folder should be created if it does not already exist. If this value is nonzero, the folder will be created. If this value is zero, the folder will not be created.

Return Value

Returns TRUE if successful, or FALSE otherwise.

Remarks

The Microsoft Internet Explorer 4.0 Desktop Update must be installed for this function to be available.

With Microsoft Windows 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable dynamic-link library (DLL), ShFolder.dll.

Function Information

Minimum DLL Versionshell32.dll version 4.71 or later
Custom ImplementationNo
Headershlobj.h
Import libraryshell32.lib
Minimum operating systemsWindows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
UnicodeImplemented as ANSI and Unicode versions. 

Retrieves the path of a special folder, identified by its CSIDL. 


CSIDL values provide a unique system-independent way to identify special folders used frequently by applications, but which may not have the same name or location on any given system. For example, the system folder may be "C:\Windows" on one system and "C:\Winnt" on another. These constants are defined in Shlobj.h and Shfolder.h.

value:

CSIDL_COMMON_STARTUP (0x0018)
The file system directory that contains the programs that appear in the Startup folder for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows NT systems.

CSIDL_DESKTOPDIRECTORY (0x0010)

The file system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself). A typical path is C:\Documents and Settings\username\Desktop.


CSIDL_APPDATA (0x001a)

Version 4.71. The file system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings\ username\Application Data. This CSIDL is supported by the redistributable Shfolder.dll for systems that do not have the Microsoft Internet Explorer 4.0 integrated Shell installed.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值