WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Floppy and CD Drives

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Format a Drive with More Options

Keywords:   format floppy drive

SHFormatDrive is available for use in the following operating systems:
Minimum supported client
 Windows XP [desktop apps only] 

Minimum supported server
 Windows Server 2003 [desktop apps only] 

End of client support
 Windows XP with SP2 

End of server support
 Windows Server 2003 
It may be altered or unavailable in subsequent versions. http://msdn.microsoft.com/en-us/library/windows/desktop/bb762169(v=vs.85).aspx
If WinVersion(5)=="2-5-1" || WinVersion(5)=="2-5-2"
   ;Must run in Windows XP or Windows 2003 Server
   ;   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)
EndIf

Article ID:   W14851
File Created: 2014:06:10:08:44:48
Last Updated: 2014:06:10:08:44:48