На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

SearchPath



The SearchPath function searches for the specified file.

DWORD SearchPath(

LPCTSTR lpPath, // address of search path
LPCTSTR lpFileName, // address of filename
LPCTSTR lpExtension, // address of extension
DWORD nBufferLength, // size, in characters, of buffer
LPTSTR lpBuffer, // address of buffer for found filename
LPTSTR *lpFilePart // address of pointer to file component
);


Parameters

lpPath

Points to a null-terminated string that specifies the path to be searched for the file. If this parameter is NULL, the function searches for a matching file in the following directories in the following sequence:

1. The directory from which the application loaded.
2. The current directory.
3. Windows 95: The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.

Windows NT: The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is SYSTEM32.

4. Windows NT: The 16-bit Windows system directory. There is no Win32 function that obtains the path of this directory, but it is searched. The name of this directory is SYSTEM.
5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
6. The directories that are listed in the PATH environment variable.

lpFileName

Points to a null-terminated string that specifies the name of the file to search for.

lpExtension

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 filename extension must be a period (.). The extension is added only if the specified filename does not end with an extension.

If a filename extension is not required or if the filename contains an extension, this parameter can be NULL.

nBufferLength

Specifies the length, in characters, of the buffer that receives the valid path and filename.

lpBuffer

Points to the buffer for the valid path and filename of the file found.

lpFilePart

Points to the address (within lpBuffer) of the last component of the valid path and filename, which is the address of the character immediately following the final backslash (\) in the path.



Return Values

If the function succeeds, the value returned is the length, in characters, of the string 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 required to hold the path.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

See Also

FindFirstFile, FindNextFile, GetSystemDirectory, GetWindowsDirectory


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

SearchPath



Функция SearchPath ищет определенный файл.

DWORD SearchPath(

LPCTSTR lpPath, // АДРЕС пути поиска LPCTSTR lpFileName, // адреса filename LPCTSTR lpExtension, // адреса расширения DWORD nBufferLength, // размера, в символах, буфера LPTSTR lpBuffer, // адреса буфера для обнаруженного filename LPTSTR *адрес lpFilePart // указателя в файловый компонент
);


Параметры

lpPath

Точки на недействительный расторгнутую строку, которые определяют путь, который нужно искать файл. Если этот параметр НЕДЕЙСТВИТЕЛЕН, функция ищет сочетающийся файл в следующих директориях в следующей последовательности:

1. Директорий из которого приложение загружалось.
2. Текущий директорий.
3. Окно 95: системный директорий Окна. Используйте функцию GetSystemDirectory, чтобы получать путь этого директория.

Окно NT: системный директорий 32- битового Окна. Используйте функцию GetSystemDirectory, чтобы получать путь этого директория. Имя этого директория - SYSTEM32.

4. Окно NT: системный директорий 16- битового Окна. Нет функции Win32, что получает путь этого директория, но поискано. Имя этого директория СИСТЕМНОЕ.
5. Директорий Окна. Используйте функцию GetWindowsDirectory, чтобы получать путь этого директория.
6. Директории, которые указаны в переменной среды ПУТИ.

lpFileName

Точки на недействительный расторгнутую строку, которые определяют имя файла, чтобы искать.

lpExtension

Точки на недействительный расторгнутую строку, которые определяют расширение, которое нужно добавлять к filename при поиске файла. Первый тип расширения filename должен быть периодом (.). Расширение добавляется только если определенный filename не заканчивается с расширением.

Если расширение filename не потребовалось или если filename содержит расширение, этот параметр может быть НЕДЕЙСТВИТЕЛЕН.

nBufferLength

Определяет длину, в символах, буфера, которая получает правильный путь и filename.

lpBuffer

Точки на буфер для правильного пути и filename файла обнаруженное.

lpFilePart

Точки по адресу (в пределах lpBuffer) последнего компонента правильного пути и filename, который - адрес символа немедленно следующего за конечной обратной косой чертой (\) в пути.



Обратные Величины

Если функция добивается успеха, возвращанная величина является длиной, в символах, строки скопированной в буфер, не включая завершающий недействительный символ. Если обратная величина больше, чем nBufferLength, возвращанная величина является размером буфера требовавшегося, чтобы держать путь.
Если функция терпит неудачу, обратная величина нулевая. Для того, чтобы расширять информацию ошибки, назовите GetLastError.

Смотри Также

FindFirstFile, FindNextFile, GetSystemDirectory, GetWindowsDirectory


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz