也就是说当前系统中U盘的盘符,谢谢!

解决方案 »

  1.   

    var
      i:integer;
      s:string;
    begin
      for i:=0 to 23 do begin
        s := Chr(67+i)+':\';
        if GetDriveType(PChar(s))= DRIVE_REMOVABLE then
          ListBox1.Items.Add(s);
      end;
    end;
      

  2.   

    //思路是监测驱动器的改变~~
    //插来插去,测试了一下,得到的数值~~type
      TForm1 = class(TForm)
        Memo1: TMemo;
      private
        { Private declarations }
        procedure WMDEVICECHANGE(var Msg: TMessage); message WM_DEVICECHANGE; //驱动器改变
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WMDEVICECHANGE(var Msg: TMessage);
    begin
      inherited;
      case Msg.WParam of
        32772: Caption := '关闭';
        32768: Caption := '就绪';
      end;
    end;