Вниз
Скачать: CL | DM;

COM port   Найти похожие ветки 

← →
Evg12   (2005-06-14 11:01) [0]

Я вот смотрю в примерах и встречаю интересный момент
при записи в порт вижу или

if not WriteFile(hPort, WriteBytes, SizeOf(WriteBytes),  dwWrite, @OverWrite) then exit;

или

dwWrite:=0;
repeat
WriteFile(hPort, WriteBytes, SizeOf(WriteBytes),  dwWrite, @OverWrite)
until dwWrite > 0;

1. Когда может возникнуть ситуация, что в первом случае записать не получится.

2. для второго случая - не возниклит ли ситуация, когда фактически в порт будет передано 2 одинаковых значения WriteBytes?


← →
Digitman ©   (2005-06-14 13:15) [1]


> Когда может возникнуть ситуация, что в первом случае записать
> не получится

цитата из справки :

If hFile was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the write operation starts at the offset specified in the OVERLAPPED structure and WriteFile may return before the write operation has been completed. In this case, WriteFile returns FALSE and the GetLastError function returns ERROR_IO_PENDING. This allows the calling process to continue processing while the write operation is being completed. The event specified in the OVERLAPPED structure is set to the signaled state upon completion of the write operation.


> для второго случая


второй пример и рассматривать всерьез не следует - в нем автор не анализирует рез-т вызова ф-ции, полагаясь на авось



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.021 c
1-1122270847
Korvet
2005-07-25 09:54
2005.08.14
Help!


3-1120485884
DelphiN!
2005-07-04 18:04
2005.08.14
Востановление "удаленных" записей из таблицы СУБД FB 1.5


14-1121844334
msguns
2005-07-20 11:25
2005.08.14
Барабашка ?


14-1122043909
Piter
2005-07-22 18:51
2005.08.14
Black Sabbath


14-1122043981
qt
2005-07-22 18:53
2005.08.14
Программирование дисковода




   Наверх