• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
April 26, 2024, 02:51:37 am

News:

SMF - Just Installed!


WMDeviceChange

Started by pipy71, March 21, 2011, 01:36:40 pm

Previous topic - Next topic

pipy71

I have nrDeviceBox on a form

I am having trouble getting the list of available com ports to update correctly when I remove a USB port.

Plugging in a new USB to serial com port works fine, its detected and shows in the nrDeviceBox correctly.

However when the USB device is unplugged from computer the removed port still shows in the nrDeviceBox!

What's the correct method for updating the nrDeviceBox when using WMDeviceChange so that removed ports don't show any more?

Thanks

Roman Novgorodov

Hello

You can call nrComm.Update method

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

pipy71

Hello

I have tried but it wont remove the com port from the nrDeviceBox1 list when I unplug the USB cable..



public
    { Public declarations }
    procedure WMDeviceChange(var Msg:TMessage); message WM_DEVICECHANGE;
  end;

procedure MyViewer.WMDeviceChange(var Msg: TMessage);
begin
  nrDeviceBox1.clear;
  nrComm1.WMDeviceChange(Msg);
  nrComm1.update;
  nrcomm1.DeviceIndex := 0;



Regards

Roman Novgorodov

Hello

Please check that nrComm.EnumPorts is epFullPresent value.

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