* * *

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

Jonvy

  • New member
  • *
  • Posts: 13
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: 6147
On Windows use Tregistry and HKEY_LOCAL_MACHINE\Hardware\DeviceMap\SerialComm or similar
I might not give the answer that you want me to.. Peter Green 1969

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 706
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 »

Jonvy

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

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus