• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

Error when re-selecting Com port using DeviceBox

Started by NigelL, November 27, 2013, 12:19:05 pm

Previous topic - Next topic

NigelL

Hello Roman

I am using a DeviceBox component to select the COM port on a simple Form. If the user selects a Com Port (e.g. COM1) the program works correctly.

If the user selects the same Com Port port again (using the DeviceBox), the program gives an error "Device "COM1" Open Error!!! Access Denied.".

I have tried to disable and re-enable the Com Port using the DeviceBoxChange procedure, but the error occurs before this procedure is called.

Do you have any suggestions on how to avoid this error?

Regards, Nigel

NigelL

I have found a solution to my own problem.  ;)

The solution was to disable the Com Port in the DeviceBoxClick procedure and then re-enable it in the DeviceBoxChange procedure.

weirdo12

I found that when trying to close and then reopen a virtual port on something like a ethernet-to-serial server I needed to put Sleep(1000) before trying to reopen the port. If you switch port numbers - close COM1 and then open COM2 for example - there is no need to call Sleep().

Roman Novgorodov

Hello

Delay between open() and close() port depend on device driver implementation.

Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.