For Newbie

Tuesday, 15 November 2011

Check the Removable Disk by Delphi


The function pulled to check whether a drive type Removable Drive or not.

Function Declaration:
CekRD function (nDrv: Char): Boolean;
begin
   if GetDriveType (PChar (nDrv + ': \')) = DRIVE_REMOVABLE then
     Result: = True / / If the result is True-type removable
   else Result: = False;
end;

Implementation # 1:
procedure TForm1.Button1Click (Sender: TObject);
begin
   if CekRD ('K') then ShowMessage ('Yes')
   else ShowMessage ('Not');
end;

Implementation # 2 (using DriveComboBox):
TForm1.DriveComboBox1Change procedure (Sender: TObject);
begin
   CheckBox1.Checked: = CekRD (DriveComboBox1.Drive);
end;

check removable disk with delphi

Share on Facebook
Share on Twitter
Share on Google+

Related : Check the Removable Disk by Delphi