Вниз
Скачать: 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
4-1118737324
AbrosimovA
2005-06-14 12:22
2005.08.14
На Дельфи OpenProcess() возвращает другое значение


1-1122372526
serg128
2005-07-26 14:08
2005.08.14
Как поменять цвет строки в TListBox?


1-1122496763
muny
2005-07-28 00:39
2005.08.14
функция power


1-1122511078
Alex_V
2005-07-28 04:37
2005.08.14
В чем причина?


1-1121805177
Adolf
2005-07-20 00:32
2005.08.14
Процедура в библи-ке




   Наверх