function SHFormatDrive(hWnd: HWND;
Drive: Word;
fmtID: Word;
Options: Word): Longint
stdcall; external 'Shell32.dll' name 'SHFormatDrive';
适用于所用windows操作系统
DWORD WINAPI SHFormatDrive(HWND hwnd,
UINT drive,
UINT fmtID,
UINT options);
//
// Special value of fmtID which means "use the defaultformat"
//
#define SHFMT_ID_DEFAULT 0xFFFF
//
// Option bits for options parameter
//
#define SHFMT_OPT_FULL 0x0001
#define SHFMT_OPT_SYSONLY 0x0002
//
// Special return values. PLEASE NOTE that these are DWORD values.
//
#define SHFMT_ERROR 0xFFFFFFFFL // Error on last format,
// drive may be formatable
#define SHFMT_CANCEL 0xFFFFFFFEL // Last format wascanceled
#define SHFMT_NOFORMAT 0xFFFFFFFDL // Drive is not formatable
#if defined (__cplusplus)
}
#endif
#endif
Here is an example call to SHFormatDrive that will format a diskette in drive "A:".
SHFormatDrive (hMainWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);