Format a floppy disk (or hard drive)

by Stuart Morris

This allows you to call a standard system dialog for formatting Floppy disks and Hard drives etc.

/* S.A.Morris - 01/02/2000 */
 
&GLOB SHFD_CAPACITY_DEFAULT 0 /* default drive capacity                 */
&GLOB SHFD_CAPACITY_360     3 /* 360KB, applies to 5.25" drives only    */
&GLOB SHFD_CAPACITY_720     5 /* 720KB, applies to 3.5" drives only     */
&GLOB SHFD_FORMAT_QUICK     0 /* quick format                           */
&GLOB SHFD_FORMAT_FULL      1 /* full format                            */
&GLOB SHFD_FORMAT_SYSONLY   2 /* copies system files only (Win95 Only!) */
 
DEFINE VARIABLE RESULT AS INTEGER NO-UNDO.
 
PROCEDURE SHFormatDrive EXTERNAL "shell32.dll" :
   DEFINE INPUT  PARAM hwndOwner   AS LONG.
   DEFINE INPUT  PARAM iDrive      AS LONG.
   DEFINE INPUT  PARAM iCapacity   AS LONG.
   DEFINE INPUT  PARAM iFormatType AS LONG.
   DEFINE OUTPUT PARAM lpResult    AS LONG.
END PROCEDURE.
 
 
RUN SHFormatDrive (INPUT  CURRENT-WINDOW:HWND,
                          0,  /* Drive A=0, B=1 (if present, otherwise C=1 etc) */
                          {&SHFD_CAPACITY_DEFAULT},
                          {&SHFD_FORMAT_QUICK},
                   OUTPUT RESULT
                  )
                  NO-ERROR. /* Needs this to stop Stack Errors */