본문 바로가기
Borland

내문서, 바탕화면 Path 찾기

by leo21c 2008. 3. 4.

Retrieves the location of a special folder.

WINSHELLAPI HRESULT WINAPI SHGetSpecialFolderLocation(;

HWND hwndOwner,

int nFolder,

LPITEMIDLIST *ppidl

);

Parameters

hwndOwner

Handle of the owner window that the client should specify if it displays a dialog box or message box.

nFolder

Value specifying the folder to retrieve the location of. This parameter can be one of the following values:

CSIDL_BITBUCKET Recycle bin ?file system directory containing file objects in the user's recycle bin. The location of this directory is not in the registry; it is marked with the hidden and system attributes to prevent the user from moving or deleting it.

CSIDL_CONTROLS Control Panel ?virtual folder containing icons for the control panel applications.

CSIDL_DESKTOP Windows desktop ?virtual folder at the root of the name space.

CSIDL_DESKTOPDIRECTORY File system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself).

CSIDL_DRIVES My Computer ?virtual folder containing everything on the local computer: storage devices, printers, and Control Panel. The folder may also contain mapped network drives.

CSIDL_FONTS Virtual folder containing fonts.

CSIDL_NETHOOD File system directory containing objects that appear in the network neighborhood.

CSIDL_NETWORK Network Neighborhood ?virtual folder representing the top level of the network hierarchy.

CSIDL_PERSONAL File system directory that serves as a common respository for documents.

CSIDL_PRINTERS Printers folder ?virtual folder containing installed printers.

CSIDL_PROGRAMS File system directory that contains the user's program groups (which are also file system directories).

CSIDL_RECENT File system directory that contains the user's most recently used documents.

CSIDL_SENDTO File system directory that contains Send To menu items.

CSIDL_STARTMENU File system directory containing Start menu items.

CSIDL_STARTUP File system directory that corresponds to the user's Startup program group.

CSIDL_TEMPLATES File system directory that serves as a common repository for document templates.

ppidl

Address that receives a pointer to an item identifier list specifying the folder's location relative to the root of the name space (the desktop).

Return Values

Returns NOERROR if successful or an OLE-defined error result otherwise.

/////////////////////////////////////////////////////////////////////////////////////////////
SHGetSpecialFolderLocation Function

Retrieves a pointer to the ITEMIDLIST structure of a special folder.

Syntax

HRESULTSHGetSpecialFolderLocation(
HWNDhwndOwner,intnFolder,PIDLIST_ABSOLUTE*ppidl);

Parameters

hwndOwner
[in]A handle to the owner window the client should specify if it displays a dialog box or message box.
nFolder
[in]A CSIDL value that identifies the folder of interest.
ppidl
[out]A pointer to an item identifier list (PIDL) specifying the folder's location relative to the root of the namespace (the desktop). It is the responsibility of the calling application to free the returned IDList by using CoTaskMemFree.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

With Microsoft Windows 2000, this function is superseded by SHGetFolderLocation.

FunctionInformation

Minimum DLL Versionshell32.dll version 4.0 or later
Custom ImplementationNo
Headershlobj.h
Import libraryshell32.lib
Minimum operating systemsWindows NT4.0, Windows95

SHGetSpecialFolderPath Function

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

Syntax

BOOLSHGetSpecialFolderPath(
HWNDhwndOwner,LPTSTRlpszPath,intnFolder,BOOLfCreate);

Parameters

hwndOwner
A handle to the owner window that the client should specify if it displays a dialog box or message box.
lpszPath
A 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 whether 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 DLL, ShFolder.dll.

FunctionInformation

Minimum DLL Versionshell32.dll version 4.71 or later
Custom ImplementationNo
Headershlobj.h
Import libraryshell32.lib
Minimum operating systemsWindows2000, Windows NT 4.0 with Internet Explorer4.0, Windows98, Windows 95 with Internet Explorer4.0
UnicodeImplemented as ANSI and Unicode versions.