网站首页  词典首页

请输入您要查询的函数:

 

术语 searchpath
释义 SearchPath
语法:
C++
DWORD WINAPI SearchPath(
__in_opt LPCTSTR lpPath,
__in LPCTSTR lpFileName,
__in_opt LPCTSTR lpExtension,
__in DWORD nBufferLength,
__out LPTSTR lpBuffer,
__out_opt LPTSTR *lpFilePart
);
SearchPath功能
搜索在一个指定的路径中指定的文件。
参数
lpPath [中,可选]
路径要搜索的文件。
如果该参数是NULL,匹配的使用注册表依赖系统文件的搜索路径搜索功能。有关详细信息,请参见备注部分。
lpFileName [in]
该文件要搜索的名称。
lpExtension [中,可选]
延长被添加到文件名的文件时,搜索。该文件的扩展名的第一个字符必须是一个句点(。)。添加延长仅当指定的文件名并没有结束的扩展名。
如果一个文件扩展名是不需要或如果文件名中包含一个扩展,这个参数可以为NULL。
nBufferLength [in]
缓冲区接收的有效路径和文件名TCHARs大小。
lpBuffer [out]
一个缓冲区指针接收路径和文件名的文件中。该字符串为null结尾的字符串。
lpFilePart [指出,可选]
一个变量的指针得到解决(在lpBuffer)对有效的路径和文件名,这是字符的地址的最后部分紧接着最后反斜杠(\\)的路径。
返回值
如果函数成功,返回值为长度,在TCHARs,认为被复制到缓冲区字符串,不包括终止空字符。如果返回值大于nBufferLength大,返回值是是须持有路径缓冲区的大小。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
如果lpPath参数为NULL,就在下面的注册表项的当前值的基础上匹配的文件SearchPath搜索:
HKEY_LOCAL_MACHINE \\系统\\ CurrentControlSet \\控制\\ Session Manager的\\ SafeProcessSearchMode
当此注册表项的值设置为“1”,SearchPath的是在系统路径中指定的文件夹第一次搜索,然后搜索当前工作文件夹。当此注册表项的值设置为“0”时,计算机首先搜索当前工作文件夹,然后搜索是在系统路径中指定的文件夹。此注册表项的系统默认值为“0”。
在搜索模式的SearchPath函数使用也可以设置每个进程通过调用SetSearchPathMode功能。
该SearchPath功能不建议作为一个定位。dll文件的方法,如果输出的使用目的是在调用LoadLibrary函数来。这可能导致错误的定位。dll文件,因为SearchPath功能搜索顺序由LoadLibrary函数所使用的搜索顺序不同。如果您需要找到并加载一个。dll文件,请使用LoadLibrary函数。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesSearchPathW(Unicode)和SearchPathA(ANSI)的
参见
文件管理函数
FindFirstFile
FindNextFile
GetSystemDirectory
GetWindowsDirectory
SetSearchPathMode
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==SearchPath Function
Searches for a specified file in a specified path.
Syntax
C++
DWORD WINAPI SearchPath(
__in_opt LPCTSTR lpPath,
__in LPCTSTR lpFileName,
__in_opt LPCTSTR lpExtension,
__in DWORD nBufferLength,
__out LPTSTR lpBuffer,
__out_opt LPTSTR *lpFilePart
);
Parameters
lpPath [in, optional]
The path to be searched for the file.
If this parameter is NULL, the function searches for a matching file using a registry-dependent system search path. For more information, see the Remarks section.
lpFileName [in]
The name of the file for which to search.
lpExtension [in, optional]
The extension to be added to the file name when searching for the file. The first character of the file name extension must be a period (.). The extension is added only if the specified file name does not end with an extension.
If a file name extension is not required or if the file name contains an extension, this parameter can be NULL.
nBufferLength [in]
The size of the buffer that receives the valid path and file name, in TCHARs.
lpBuffer [out]
A pointer to the buffer to receive the path and file name of the file found. The string is a null-terminated string.
lpFilePart [out, optional]
A pointer to the variable to receive the address (within lpBuffer) of the last component of the valid path and file name, which is the address of the character immediately following the final backslash (\\) in the path.
Return Value
If the function succeeds, the value returned is the length, in TCHARs, of the string that is copied to the buffer, not including the terminating null character. If the return value is greater than nBufferLength, the value returned is the size of the buffer that is required to hold the path.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
If the lpPath parameter is NULL, SearchPath searches for a matching file based on the current value of the following registry key:
HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\SafeProcessSearchMode
When the value of this registry key is set to "1", SearchPath first searches the folders that are specified in the system path, and then searches the current working folder. When the value of this registry entry is set to "0", the computer first searches the current working folder, and then searches the folders that are specified in the system path. The system default value for this registry key is "0".
The search mode used by the SearchPath function can also be set per-process by calling the SetSearchPathMode function.
The SearchPath function is not recommended as a method of locating a .dll file if the intended use of the output is in a call to the LoadLibrary function. This can result in locating the wrong .dll file because the search order of the SearchPath function differs from the search order used by the LoadLibrary function. If you need to locate and load a .dll file, use the LoadLibrary function.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesSearchPathW (Unicode) and SearchPathA (ANSI)
See Also
File Management Functions
FindFirstFile
FindNextFile
GetSystemDirectory
GetWindowsDirectory
SetSearchPathMode
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa365527(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:23:28