Hola, Dani.
No estoy familiarizado con los hilos TThread.
Intentaré implementarlo y te contaré.
Si me veo obligado y no soy capaz, te rogaría que me ayudaras implementándolo en el procedimiento que me originó el problema y yo ya lo trasladaría a otros problemas similales.
Gracias.
Código Delphi
[-]
procedure TDevice.ListaDevices;
var
Msg: string;
I, B: Integer;
ListaVinculados: TBluetoothDeviceList;
LServices: TBluetoothServiceList;
begin
try
FBluetoothManager := TBluetoothManager.Current;
if FBluetoothManager = nil
then begin
Close;
end;
FBluetoothManager.SocketTimeout := 100;
BluetoothAdapter := FBluetoothManager.CurrentAdapter;
if BluetoothAdapter = nil
then begin
Close;
end;
ListaVinculados := FBluetoothManager.GetPairedDevices(BluetoothAdapter);
if ListaVinculados = nil
then begin
Close;
end;
ComboDevices.Items.Clear;
for I := 0 to ListaVinculados.Count - 1 do
begin
Impresora := ListaVinculados[i] as TBluetoothDevice;
if Impresora.IsPaired then
begin
LServices := Impresora.GetServices;
for B := 0 to LServices.Count - 1 do
begin
ServiceGUI := GUIDToString(LServices[b].UUID);
Guid := LServices[b].UUID;
ServiceName := LServices[b].Name;
end;
end
else begin
Close;
end;
ComboDevices.Items.Add(Impresora.DeviceName);
end;
except
on E: Exception do
begin
Close;
end;
end;
FBluetoothManager.Free;
BluetoothAdapter.Free;
Guid.Empty;
if ComboDevices.Items.Count > 0 then ComboDevices.ItemIndex := 0;
end;
Un saludo muy efusivo.