  1 unit shfmtu;
  2 
  3 interface
  4 
  5 uses
  6   Windows, Messages, SysUtils, Classes, Graphics, Controls,
  7   Forms, Dialogs, ShFormat, StdCtrls, FileCtrl;
  8 
  9 type
 10   TShFmtForm = class(TForm)
 11     DriveComboBox1: TDriveComboBox;
 12     bFormat: TButton;
 13     procedure bFormatClick(Sender: TObject);
 14   end;
 15 
 16 var
 17   ShFmtForm: TShFmtForm;
 18 
 19 implementation
 20 
 21 {$R *.DFM}
 22 
 23 procedure TShFmtForm.bFormatClick(Sender: TObject);
 24 var FmtRes: LongInt; DriveNo: Word;
 25 begin
 26   { 0 = A:, 1 = B: usw. }
 27   DriveNo := Ord(Upcase(DriveComboBox1.Drive))-Ord('A');
 28   FmtRes := ShFormatDrive(Handle,DriveNo,SHFMT_ID_DEFAULT,
 29     SHFMT_OPT_QUICKFORMAT);
 30   if FmtRes < 0 then ShowMessage('Abbruch bzw. Fehler')
 31    else ShowMessage('Formatierungs-ID '+IntToStr(FmtRes));
 32 end;
 33 
 34 end.
