Recent

Author Topic: T-LazSerial, how can I know PC'com port configuration with LazSerial control?  (Read 1492 times)

Jonvy

  • New member
  • *
  • Posts: 24
Hi all,
I'm using TLazSerial making a program to use RS232 port send and receive data.
Because this is a common program, it can be used in different PC, and the user can set different port to connect device.

I want to make the program to check the PC's configuration, so it knows how many serial ports and ports number in the PC.So use can choose serial port they want to use from port list.

How can I know this information and let program check.

The program will running on Windows 7 system.

Thanks a lot!

Jonvy

Thaddy

  • Hero Member
  • *****
  • Posts: 7606
On Windows use Tregistry and HKEY_LOCAL_MACHINE\Hardware\DeviceMap\SerialComm or similar
Ad Brexinitum (can't help it)

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 753
hello,
use GetSerialPortNames function from the lazsynaser unit (Comma delimited string)included in Tlazserial package.
example : 
Code: Pascal  [Select]
  1. var myComPorts : String;
  2. begin
  3. myComPorts := GetSerialPortnames();
  4. end;

Edit : with TLAzserial you have a form to choose the com port see sertest project.
Code: Pascal  [Select]
  1. procedure TFMain.BPortSettingsClick(Sender: TObject);
  2. begin
  3.   Serial.ShowSetupDialog;
  4.   EditDevice.Text := Serial.Device;
  5. end;  
Friendly, J.P
« Last Edit: May 31, 2018, 08:53:35 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Jonvy

  • New member
  • *
  • Posts: 24
Thanks for your support, both of your way is working!