-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hello, MHumm!
If an instance of TCommPortDriver is created in a separate thread, the data arrival event in the port buffer is not triggered, apparently due to the fact that the window function is used for verification. For normal operation, I had to add a system message processing cycle to the Execute procedure
procedure TMeterThread.Execute;
...
Cprt := TCommPortDriver.Create( nil );
Cprt.BaudRate := br9600;
Cprt.StopBits := sb1BITS;
Cprt.Parity := ptNONE;
Cprt.DataBits := db8BITS;
Cprt.PollingDelay := 50;
Cprt.PacketSize := -1;
Cprt.Port := TPortNumber( PrtNm.Substring( 3 ).ToInteger ); // Number in the "\\.\COMn"
Cprt.OnReceiveData := CPRxChar; // <- OnReceiveData - does not work in TMeterThread :((
Cprt.OnError := CommPortError;
...
// But if you add the lines below, the OnReceiveData event starts
case MsgWaitForMultipleObjectsEx( 0, nil^, 50, QS_ALLINPUT, 0 ) of
WAIT_OBJECT_0:
begin
while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do
begin
if Msg.message = WM_QUIT then
Exit;
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;
WAIT_FAILED:
Break;
end;
...
end; // of Execute
Is there any way to take this into account in a future release?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request