ISCL is a Intelligent Information Consulting System. Based on our knowledgebase, using AI tools such as CHATGPT, Customers could customize the information according to their needs, So as to achieve

List Devices (LPT, COM ports, ...)

14
The following procedure will list all the devices on your computer. You can then extract the com ports and printer ports by looking for the 'COM' and 'LPT' characters in the list.

Add a Memo and a Button and place this code in the OnClick of a button...

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.Button1Click(Sender: TObject) ;
var
  istr: string;
  isize, j: dword;
begin
   setlength(istr, 4000) ;
   isize := QueryDosDevice(nil, @istr[1], 4000) ;
   for j := 1 to isize do
     if istr[j] = #0 then istr[j] := #10;
   memo1.lines.CommaText := istr;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Get system info (free memory, etc)
« Get the Height/Width of a Character (for OwnerDrawing and printing)

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.