CONST SHFMT_ID_DEFAULT = 0
DECLARE FUNCTION SHFormatDrive LIB "shell32.dll" ALIAS "SHFormatDrive" ( hwnd AS LONG, drive AS INTEGER, fmtID AS INTEGER, options AS INTEGER) AS LONG
DECLARE SUB Button1Click (Sender AS QBUTTON)
CREATE Form AS QFORM
CAPTION = "Form1"
Width = 320
Height = 240
Center
CREATE Button1 AS QBUTTON
CAPTION = "Format this floppy disk"
Left = 20
Top = 149
width = 280
OnClick = Button1Click
END CREATE
END CREATE
Form.SHOWMODAL
SUB Button1Click (Sender AS QBUTTON)
DIM Réponse AS LONG
Ret = SHFormatDrive(hwnd, 0, SHFMT_ID_DEFAULT, 0)
IF Réponse = 0 THEN
SHOWMESSAGE("Success !")
ELSE
SHOWMESSAGE("Impossible to do this operation" & CHR$(13) & "Error.")
END IF
END SUB
|