I am using Delphi 10.3 on Windows 10.
I need to find the COM ports that a paired Bluetooth device is using, and then connect to the device.
I have looked on Bluetooth manager and found nothing relating to COM port.
I am using Delphi 10.3 on Windows 10.
I need to find the COM ports that a paired Bluetooth device is using, and then connect to the device.
I have looked on Bluetooth manager and found nothing relating to COM port.
This code 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 the button.
Procedure Tform1.Button1Click(sender:Tobject);
var
iStr:string;
iSize,i:Dword;
begin
setlength(sStr,4000);
iSize:= QueryDosDevice(nil,@iStr[i],4000);
for i:= to iSize do
if iStr[i]=#0 then iStr[i]:=#10;
memo1.lines.commatext:=iStr;
end;`
This code is not mine credit to the person who wrote it. If this isnt the code you're looking for I'll take it down.