TVaComm in a DLL

Hello Bruno

I really really need your support here. Please help me out ... I need very urgent at least a workaround for this OnRxChar DLL behaviour...

Please take a little time... Can you please inform me how and when you will support us here?

Best regards

I spent as much time as I could afford for now on this and it's a non trivial Windows message routing issue. As an immediate workaround, I'd suggest to add a timer and check with this timer for VaComm.ReadBufUsed > 0. When this condition is true, this is equivalent to having OnRxChar triggered.

Thanks Bruno, I'll give this a try.

The workaround works for me. I have a 1 second timer that checks the ReadBufUsed and then calls the OnRxChar. In OnRxChar I had to close and then open the port after reading the data otherwise the device wouldn't listen to the second command, but that could be a device thing, not a VaComm thing.

Thanks again Bruno.

Hello,

Is there a proper solution for this problem yet?
The last posting is over 1 year old and the "solution" was just a quick workaround.
Now I have the same problem and the only way it works is with a timer:

procedure TBarcodePanelForm.Timer1Timer(Sender: TObject);
begin
  if Barcode.Port.Active and (Barcode.Port.ReadBufUsed > 0) then begin
    Barcode.Port.Close;
    Barcode.Port.Open;
    end;
end;

but I don't see this as a permanent solution.

Thank you.

Given it is rather exceptional to use TVaComm from a DLL, very few users do this and combined with the fact it is technically not trivial to handle, we haven't given priority to this so far.

OK,
then how about a proper call, for example "Barcode.Port.SynchronizeThreads" or something like that instead of a Port.Close / Port.Open call.
The problem is that the OnRxChar event is called on Port.Close and the port remains closed until it's processed. All other barcodes that are scaned during this time are not read by the component because the port is closed.

Try to call first Vacomm.PurgeReadWrite

PurgeReadWrite did not work :(

I had to create a wrapper class for TVaComm:

  TComPortWrapper = class(TVaComm)
  public
    procedure ManualEventCall;
  end;

procedure TComPortWrapper.ManualEventCall;
begin
  HandleDataEvent;
end;

and, in the Timer event call this procedure:

  if Barcode.Port.Active and (Barcode.Port.ReadBufUsed > 0) then
    Barcode.Port.ManualEventCall;

with this workaround looks like it's working, but I'll have to test it under other scenarios as well.
Maybe someday you will find a solution for this problem.

Please provide some sample source with which we can reproduce this issue here.
I did a new test here with a TVaComm instance coupled to an read memo & a write memo in a DLL and I could do communication to the same app on another machine.