Простой примерчик:
| Код | function SHFormatDrive(hWnd: HWND; Drive: Word; fmtID: word; Options: word): longint; stdcall, external 'Shell32.dll' name 'SHFormatDrive';
procedure FormatDrive(Drive: char); begin try case SHFormatDrive(Application.Handle, ord(Drive) - ord('A'), $FFFF, 1 {1- Full, 0 - Quick, 2 - SysOnly}) of -1: ShowMessage('Error formatting the drive'); -2: ShowMessage('User canceled formatting the drive'); -3: ShowMessage('No format'); end; except ShowMessage('Error formatting the drive'); end; end;
| |