网站首页  词典首页

请输入您要查询的函数:

 

术语 shsetfolderpath
释义 SHSetFolderPath
语法:
HRESULT SHSetFolderPath( int csidl,
HANDLE hToken,
DWORD dwFlags,
LPCTSTR pszPath
);
SHSetFolderPath功能
已过时。指定一个新的路径到系统文件夹的的CSIDL确定。
参数
的CSIDL
[in]阿CSIDL值标识该文件夹的路径被设置。只有物理文件夹是有效的。如果一个指定的虚拟文件夹,这个功能失败。
添加CSIDL_FLAG_DONT_UNEXPAND价值的CSIDL,以确保该字符串被写入完全按照所提供的注册表。如果CSIDL_FLAG_DONT_UNEXPAND标志不包括路径的部分可能被替换的环境字符串诸如%USERPROFILE%。
hToken
[in]一个访问令牌可以用来表示一个特定的用户。此参数通常设置为NULL,在这种情况下,函数试图访问当前用户的文件夹的实例。但是,您可能需要指定一个值hToken对这些文件夹可以有多个用户,但属于单个用户处理。这一类型的最常用的文件夹中的文件。
调用应用程序负责时hToken正确模拟非空。它必须有特定的用户,包括TOKEN_QUERY和TOKEN_IMPERSONATE适当的安全权限,以及用户的注册表配置单元当前必须安装。见的访问控制问题的进一步讨论访问控制。
dwFlags
[in]保留。必须设置为0。
pszPath
[in]指向一个空结束的长度MAX_PATH,其中包含该文件夹的新路径字符串。此值不能为NULL,而且不能串长度为零。
返回值
返回标准的hresult代码,其中包括以下内容:
S_OKThe文件夹的路径已成功更新。
E_INVALIDARGSeveral错误条件导致此值的回报,包括下列内容:
该CSIDL值无效。
该CSIDL值不是指一个虚拟文件夹。
该CSIDL值不是指一个系统文件夹。
在CSIDL值指的是不能重命名或移动文件夹。
该dwFlags值不为0(零)。
该pszPath值为NULL。
该字符串指向pszPath值为空字符串(“”)的长度为零。
备注
注意:由于Windows Vista中,这项功能只不过是SHSetKnownFolderPath包装。该CSIDL值被转换到其关联KNOWNFOLDERID和SHSetKnownFolderPath被调用。新的应用程序应该使用已知的文件夹系统,而不是旧的CSIDL系统,该系统只支持向后兼容。
SHSetFolderPath不是出口的名称从Shell32.dll中。要使用的功能,您必须调用顺序为SHSetFolderPathA 231调用GetProcAddress(为ANSI字符串)或序号232 SHSetFolderPathW(为Unicode字符串)来获取一个函数指针。
建议将路径作为Unicode字符串表示,因为文件夹名称可能包含不以ANSI可表达Unicode字符。
功能信息
最低DLL版本 shell32.dll 5.0或更新版本
自定义ImplementationNo
Headershlobj.h
import libraryshell32.lib
XP的最低经营systemsWindows
UnicodeImplemented为ANSI和Unicode版本。
参见
IKnownFolder::SetPath
==英文原文==SHSetFolderPath Function
Deprecated. Assigns a new path to a system folder identified by its CSIDL.
Syntax
HRESULT SHSetFolderPath( int csidl,
HANDLE hToken,
DWORD dwFlags,
LPCTSTR pszPath
);
Parameters
csidl
[in] A CSIDL value that identifies the folder whose path is to be set. Only physical folders are valid. If a virtual folder is specified, this function fails.
Add the CSIDL_FLAG_DONT_UNEXPAND value to the CSIDL to ensure that the string is written to the registry exactly as provided. If the CSIDL_FLAG_DONT_UNEXPAND flag is not included, portions of the path may be replaced by environment strings, such as %USERPROFILE%.
hToken
[in] An access token that can be used to represent a particular user. This parameter is usually set to NULL, in which case the function tries to access the current user's instance of the folder. However, you may need to assign a value to hToken for those folders that can have multiple users but are treated as belonging to a single user. The most commonly used folder of this type is Documents.
The calling application is responsible for correct impersonation when hToken is non-null. It must have appropriate security privileges for the particular user, including TOKEN_QUERY and TOKEN_IMPERSONATE, and the user's registry hive must be currently mounted. See Access Control for further discussion of access control issues.
dwFlags
[in] Reserved. Must be set to 0.
pszPath
[in] A pointer to a null-terminated string of length MAX_PATH that contains the folder's new path. This value cannot be NULL, and the string cannot be of zero length.
Return Value
Returns standard HRESULT codes, including the following:
S_OKThe folder's path was successfully updated.
E_INVALIDARGSeveral error conditions cause the return of this value, including the following:
The csidl value is not valid.
The csidl value does not refer to a virtual folder.
The csidl value does not refer to a system folder.
The csidl value refers to a folder that cannot be renamed or moved.
The dwFlags value is not 0 (zero).
The pszPath value is NULL.
The string pointed to by pszPath value is an empty string ("") of length zero.

Remarks
Note As of Windows Vista, this function is merely a wrapper for SHSetKnownFolderPath . The CSIDL value is translated to its associated KNOWNFOLDERID and SHSetKnownFolderPath is called. New applications should use the known folder system rather than the older CSIDL system, which is supported only for backward compatibility.
SHSetFolderPath is not exported by name from Shell32.dll. To use the function, you must call GetProcAddress with ordinal 231 for SHSetFolderPathA (for ANSI strings) or ordinal 232 for SHSetFolderPathW (for Unicode strings) to obtain a function pointer.
It is recommended that the paths be expressed as Unicode strings because folder names might contain Unicode characters not expressible in ANSI.
Function Information
Minimum DLL Versionshell32.dll version 5.0 or later
Custom ImplementationNo
Headershlobj.h
Import libraryshell32.lib
Minimum operating systemsWindows XP
UnicodeImplemented as ANSI and Unicode versions.
See Also
IKnownFolder::SetPath
==原始网址==http://msdn.microsoft.com/en-us/library/bb762247(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:30:41