На главную

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 | Скачать Вниз

GetOverlappedResult



The GetOverlappedResult function returns the results of an overlapped operation on the specified file, named pipe, or communications device.

Windows 95: This function works only on serial devices or on files opened by using the DeviceIoControl function.

BOOL GetOverlappedResult(

HANDLE hFile, // handle of file, pipe, or communications device
LPOVERLAPPED lpOverlapped, // address of overlapped structure
LPDWORD lpNumberOfBytesTransferred, // address of actual bytes count
BOOL bWait // wait flag
);


Parameters

hFile

Identifies the file, named pipe, or communications device. This is the same handle that was specified when the overlapped operation was started by a call to the ReadFile, WriteFile, ConnectNamedPipe, TransactNamedPipe, DeviceIoControl, or WaitCommEvent function.

lpOverlapped

Points to an OVERLAPPED structure that was specified when the overlapped operation was started.

lpNumberOfBytesTransferred

Points to a 32-bit variable that receives the number of bytes that were actually transferred by a read or write operation. For a TransactNamedPipe operation, this is the number of bytes that were read from the pipe. For a DeviceIoControl operation, this is the number of bytes of output data returned by the device driver. For a ConnectNamedPipe or WaitCommEvent operation, this value is undefined.

bWait

Specifies whether the function should wait for the pending overlapped operation to be completed. If TRUE, the function does not return until the operation has been completed. If FALSE and the operation is still pending, the function returns FALSE and the GetLastError function returns ERROR_IO_INCOMPLETE.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The results reported by the GetOverlappedResult function are those of the specified handle's last overlapped operation to which the specified OVERLAPPED structure was provided, and for which the operation's results were pending. A pending operation is indicated when the function that started the operation returns FALSE, and the GetLastError function returns ERROR_IO_PENDING. When an I/O operation is pending, the function that started the operation resets the hEvent member of the OVERLAPPED structure to the nonsignaled state. Then when the pending operation has been completed, the system sets the event object to the signaled state.

If the bWait parameter is TRUE, GetOverlappedResult determines whether the pending operation has been completed by waiting for the event object to be in the signaled state.
If the hEvent member of the OVERLAPPED structure is NULL, the system uses the state of the hFile handle to signal when the operation has been completed. Use of file, named pipe, or communications-device handles for this purpose is discouraged. It is safer to use an event object because of the confusion that can occur when multiple simultaneous overlapped operations are performed on the same file, named pipe, or communications device. In this situation, there is no way to know which operation caused the object's state to be signaled.

Specify a manual-reset event object in the OVERLAPPED structure. If an auto-reset event object is used, the event handle must not be specified in any other wait operation in the interval between starting the overlapped operation and the call to GetOverlappedResult. For example, the event object is sometimes specified in one of the wait functions to wait for the operation's completion. When the wait function returns, the system sets an auto-reset event's state to nonsignaled, and a subsequent call to GetOverlappedResult with the bWait parameter set to TRUE causes the function to be blocked indefinitely.

See Also

CancelIo, ConnectNamedPipe, CreateEvent, DeviceIoControl, GetLastError, OVERLAPPED, ReadFile, TransactNamedPipe, WaitCommEvent, WriteFile


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

GetOverlappedResult



Функция GetOverlappedResult возвращает результаты перекрытого действия на определенный файл, назвавшего трубу, или устройство связи.

Окно 95: Эта функция работает только на последовательных устройствах или в файлах открытых использованием функции DeviceIoControl.

BOOL GetOverlappedResult(

РУЧКА hFile, // ручка файла, трубы, или устройство связи LPOVERLAPPED lpOverlapped, // адрес перекрытой структуры LPDWORD lpNumberOfBytesTransferred, // адрес фактического счета флага ожидания байтов BOOL bWait //
);


Параметры

hFile

Идентифицирует файл, назвавший трубу, или устройство связи. Это - та же ручка, которая была определена когда перекрытое действие было начато вызовом в ReadFile, WriteFile, ConnectNamedPipe, TransactNamedPipe, DeviceIoControl, или функцию WaitCommEvent.

lpOverlapped

Точки на ПЕРЕКРЫТУЮ структуру, которые были определены когда перекрытое действие было начато.

lpNumberOfBytesTransferred

Точки на 32- битовую переменную, которые получают количество байтов, которые действительно были переданы действием чтения или записи. Для действия TransactNamedPipe, это - количество байтов, которые были прочитаны из трубы. Для операции DeviceIoControl, это - количество байтов выходных данных возвращанных драйвером устройства. Для ConnectNamedPipe или операции WaitCommEvent, эта величина неопределенная.

bWait

Определяет должна функция ждать незаконченную перекрытую операцию, которая нужно завершаться. Если ИСТИНА, функция не возвращается пока операция не завершена. Если ЛОЖЬ и операция все еще рассматривается, функция возвращает ЛОЖЬ и функциональный возврат GetLastError ERROR_IO_INCOMPLETE.



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

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

Замечания

Результаты выданные функцией GetOverlappedResult - определенного оперировать последний раз перекрывшее операцию на которой определенная ПЕРЕКРЫТАЯ структура была предусмотрена, и для которого операция результатов рассматривалась. Незаконченная операция указана когда функция, которая запускала операцию ЛЖИ возврата, и функциональный возврат GetLastError ERROR_IO_PENDING. Когда операция В/В рассматривается, функция, которая запускала операцию сбрасывает элемент hEvent ПЕРЕКРЫТОЙ структуры в nonsignaled состояние. Затем когда незаконченная операция завершена, система устанавливает объект события против сигнального состояния.

Если параметр bWait - ИСТИНА, GetOverlappedResult определяет завершена незаконченная операция ожиданием объекта события против быть в сигнальном состоянии.
Если элемент hEvent ПЕРЕКРЫТОЙ структуры НЕДЕЙСТВИТЕЛЕН, система использует состояние ручки hFile, чтобы сигнализировать когда операция завершена. Использование файловой, поименованной трубы, или связь-устройство ручек с этой целью отговорено. Это - защита, чтобы использовать объект события из-за неразберихи, которая может произойти когда многочисленные одновременные перекрытые операции выполнены в том же файле, названы труба, или устройство связи. В этой ситуации, нет пути знать какую операцию вызвавшую объектное состояние, которое нужно сигнализировать.

Определите руководство-восстановившее объект события в ПЕРЕКРЫТОЙ структуре. Если авто-восстановившее объект события использован, ручка события не должна определена на любой другой операции ожидания в интервале между запуском перекрытой операции и вызов на GetOverlappedResult. Например, объект события иногда определен в одной из функций ожидания, чтобы ждать операцию завершения. Когда функция ожидания возвращается, системные комплекты авто-восстановившее состояние события на nonsignaled, и последующий вызов на GetOverlappedResult с параметром bWait был установлен в причины ИСТИНЫ функция, которая нужно блокироваться неопределенно.

Смотри Также

CancelIo, ConnectNamedPipe, CreateEvent, DeviceIoControl, GetLastError, ПЕРЕКРЫТОЕ, ReadFile, TransactNamedPipe, WaitCommEvent, WriteFile


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