Tema: Detectar USB
Ver Mensaje Individual
  #2  
Antiguo 30-10-2010
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola mefixxto.

Desde Delphi, se puede hacer así:
Código Delphi [-]
procedure ActivarUSB(Activo: Boolean);
begin
  with TRegistry.Create do
  try
    RootKey:= HKEY_LOCAL_MACHINE;
    if OpenKey('\SYSTEM\CurrentControlSet\Services\USBSTOR',True) then
    begin
      if Activo then
        WriteInteger('Start',3)
      else
        WriteInteger('Start',4);
      CloseKey;
    end;
  finally
    Free;
  end;
end;

Ejemplos de llamada:
Código Delphi [-]
...
procedure TForm1.btActivarClick(Sender: TObject);
begin
  ActivarUSB(True);
end;

procedure TForm1.btDesactivarClick(Sender: TObject);
begin
  ActivarUSB(False);
end;
...


Saludos.

Última edición por ecfisa fecha: 30-10-2010 a las 23:02:43.
Responder Con Cita