Formatting A Floppy Disk
Posted on 1998-11-15
How do I Quick Format a floppy disk in the background. I got this code from a previously answered Q but it pulls up the windows format dialog. I need to do it completely in the background. Code that will just erase all files and directories from a floppy will do just as well.
SHFMT_ID_DEFAULT = $FFFF;
SHFMT_OPT_QUICKFORMAT = $0000;
SHFMT_OPT_FULL = $0001;
SHFMT_OPT_SYSONLY = $0002;
SHFMT_ERROR = $FFFFFFFF;
SHFMT_CANCEL = $FFFFFFFE;
SHFMT_NOFORMAT = $FFFFFFFD;
function SHFormatDrive(Handle: HWND; Drive, ID, Options: Word): LongInt;
stdcall; external 'shell32.dll' name 'SHFormatDrive'
procedure TForm1.btnFormatDiskClick(Sender: TObject);
Code:= SHFormatDrive(Handle, 0, SHFMT_ID_DEFAULT, SHFMT_OPT_QUICKFORMAT);
if Code < 0 then
ShowMessage('Could not format floppy drive');
Sorry about the lack of points, it's all I've got.