为何不看已答问题?<br><br><br>JJlei<br>来自uddf的回答:<br>There is an API hidden away in Shell32.dll called SHFormatDrive, this brings up the standard format removable drive dialog. I stumbled across this in the borland.public.delphi.winapi newsgroup.<br><br>{implementation section}<br>..<br>..<br>const<br> SHFMT_ID_DEFAULT = $FFFF;<br> // Formating options<br> SHFMT_OPT_QUICKFORMAT = $0000;<br> SHFMT_OPT_FULL = $0001;<br> SHFMT_OPT_SYSONLY = $0002;<br> // Error codes<br> SHFMT_ERROR = $FFFFFFFF; <br> SHFMT_CANCEL = $FFFFFFFE; <br> SHFMT_NOFORMAT = $FFFFFFFD; <br><br>function SHFormatDrive(Handle: HWND; Drive, ID, Options: Word): LongInt;<br> stdcall; external 'shell32.dll' name 'SHFormatDrive'<br><br>procedure TForm1.btnFormatDiskClick(Sender: TObject);<br>var<br> retCode: LongInt;<br>begin<br> retCode:= SHFormatDrive(Handle, 0, SHFMT_ID_DEFAULT,<br> SHFMT_OPT_QUICKFORMAT);<br> if retCode < 0 then<br> ShowMessage('Could not format drive');<br>end;<br><br>end.