How can I determine the names of the installed comm ports?
2009-05-07 16:12
405 查看
The following example demonstrates enumerating the communications ports that are installed and listed in the Win32 registry.
uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
reg : TRegistry;
ts : TStrings;
i : integer;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('hardware\devicemap\serialcomm',
false);
ts := TStringList.Create;
reg.GetValueNames(ts);
for i := 0 to ts.Count -1 do begin
Memo1.Lines.Add(reg.ReadString(ts.Strings[i]));
end;
ts.Free;
reg.CloseKey;
reg.free;
end;
uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
reg : TRegistry;
ts : TStrings;
i : integer;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('hardware\devicemap\serialcomm',
false);
ts := TStringList.Create;
reg.GetValueNames(ts);
for i := 0 to ts.Count -1 do begin
Memo1.Lines.Add(reg.ReadString(ts.Strings[i]));
end;
ts.Free;
reg.CloseKey;
reg.free;
end;
相关文章推荐
- List of X$ Tables and how the names are derived
- How can I determine the URL that a local Git repository was originally cloned from?
- Inteface Buidler can't determine the type of "xx.xib" this may be due to a missing SDK.
- How do I determine the expiration date of a p12 certificate?
- How to determine which version of .net framework are installed
- How can we identify the weights of different models for ensemble?
- List of X$ Tables and how the names are derived
- How one VBA project can use an object declared in the class module of another project
- Where can I find the location of folders for installed programs?
- List of X$ Tables and how the names are derived
- How can I set the background of UITableView (the tableview style is "Grouped") to use an image?
- How can I get the logical valume by the datafile names and ASM disks?
- How can I get the logical valume by the datafile names and ASM disks?
- How to Determine the Version of Oracle XML Publisher for Oracle E-Business Suite 11i and Release 12 (Doc ID 362496.1)
- 【杂】How to determine which edition of Exchange Server is installed
- Question 33: How can a C++ developer use the placement new syntax to make new allocate an object of class SomeClass at a particu
- How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?
- HDOJ_ How can I read input data until the end of file ?
- How You Can Cash In On The Green Gold Rush of 2014
- 《How hard can it be? Estimating the difficulty of visual search in an image》和 PPT