Recent

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

Jonvy

  • Jr. Member
  • **
  • Posts: 90
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: 14361
  • Sensorship about opinions does not belong here.
On Windows use Tregistry and HKEY_LOCAL_MACHINE\Hardware\DeviceMap\SerialComm or similar
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Jurassic Pork

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

  • Jr. Member
  • **
  • Posts: 90
Thanks for your support, both of your way is working!

 

TinyPortal © 2005-2018