DWORD SearchPath(lpszPath, lpszFile, lpszExtension, cchReturnBuffer, lpszReturnBuffer, plpszFilePart) | |||||
LPCTSTR lpszPath; | /* address of the search path | */ | |||
LPCTSTR lpszFile; | /* address of the filename | */ | |||
LPCTSTR lpszExtension; | /* address of the extension | */ | |||
DWORD cchReturnBuffer; | /* size of the buffer in characters | */ | |||
LPTSTR lpszReturnBuffer; | /* address of buffer for found filename | */ | |||
LPTSTR *plpszFilePart; | /* address of pointer to file part | */ |
The SearchPath function searches for the specified file.
lpszPath
Points to a null-terminated string that specifies the search path to be used for locating the file. If lpszPath is NULL, the default windows search path is used. The default path is:
1.The current directory
2.The windows system directory
3.The windows directory
4.The directories listed in the path environment variable
lpszFile
Points to a null-terminated string that specifies the name of the file for which to search.
lpszExtension
Points to a null-terminated string that specifies an extension to be added to the filename when searching for the file. The first character of the extension must be a period (.). The extension is only added if the specified filename does not end with an extension.
This parameter can be NULL if a file extension is not required, or if the filename contains an extension.
cchReturnBuffer
Specifies the length of the buffer (in characters) that receives the fully-qualified path and filename.
lpszReturnBuffer
Points to the buffer for the fully-qualified path and filename of the found file.
plpszFilePart
Specifies the address (within lpszReturnBuffer) of the last component of the fully-qualified path and filename. This is the address of the character immediately following the final backslant in the path; it points to the filename.
If the function is successful, the return value is the length of the string copied to lpszReturnBuffer (in characters), not including the terminating null character. If the return value is greater than cchReturnBuffer, the return value is the size of the buffer required to hold the path.
If the function fails, the return value is zero. Use the GetLastError function to obtain extended error information.
The SearchPath function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).
FindFirstFile, FindNextFile