Delphi procedures used to achieve the U disk drive is not difficult to obtain, but for the new term may be a bit difficult to put out the code for them to learn from
procedure TForm1.FormCreate (Sender: TObject);
var
buf: array [0 .. MAX_PATH-1] of char;
m_Result: Integer;
i: Integer;
str_temp: string;
begin
m_Result: = GetLogicalDriveStrings (MAX_PATH, buf);
for i: = 0 to (m_Result div 4) do
begin
str_temp: = string (buf [i * 4] + buf [i * 4 +1] + buf [i * 4 +2]);
if getdrivetype (pchar (str_temp)) = DRIVE_REMOVABLE then
begin
showmessage (str_temp + 'set for U disk');
ListBox1.Items.Add (str_temp);
end;
end; |