• Breaking News

    Panduan dan Tutorial Lengkap serta Materi Pelajaran di Mulyono Blog. Konten Terlengkap dan Terpercaya

    Selasa, 20 September 2011

    Mencari tipe drive dengan delphi

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    StdCtrls;

    type
    TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.DFM}

    procedure TForm1.Button1Click(Sender: TObject);
    var
    typ:Integer;
    s : string;
    begin
    s := 'C:\';
    typ := GetDriveType(PChar(s));
    if Typ <> 0 then case typ of
    DRIVE_REMOVABLE:
    begin
    ShowMessage('Drive Removable / Diskette');
    end;
    DRIVE_FIXED:
    begin
    ShowMessage('Drive fixed');
    end;
    DRIVE_CDROM:
    begin
    ShowMessage('CD ROM Drive');
    end;
    DRIVE_RAMDISK:
    begin
    ShowMessage('RAM Drive');
    end;
    DRIVE_REMOTE:
    begin
    ShowMessage('Remote Drive');
    end;
    end;
    end;

    end.