Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Format a Drive with More Options

Keywords:   format floppy drive


;   DWORD WINAPI SHFormatDrive(HWND hwnd,
;                              UINT drive,
;                              UINT fmtID,
;                              UINT options);

; Special value of fmtID which means "use the defaultformat"
 SHFMT_ID_DEFAULT =  65535

; Option bits for options parameter
SHFMT_OPT_FULL     = 1
SHFMT_OPT_SYSONLY   =2

; Special return values. PLEASE NOTE that these are DWORD values.
SHFMT_ERROR  = -1  ; Error on last format,

; drive may be formatable

SHFMT_CANCEL    = -2     ; Last format was canceled

SHFMT_NOFORMAT  = -3    ; Drive is not formatable

; Here is an example call to SHFormatDrive that will format a diskette in drive "A:". 

;   SHFormatDrive (hMainWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0); 

dll=Strcat(DirWindows(1),"shell32.dll")
hwnd=DllHwnd("") ; helps windows figure out where to put dialog box
drive = 0   ; a=0 b=1 c=2 etc
retvalue=DllCall(dll,long:"SHFormatDrive",long:hwnd,long:drive,long:SHFMT_ID_DEFAULT,long:SHFMT_OPT_FULL)
Message("Return Value",retvalue)



Article ID:   W14851