When I am using the below code, it appears a Windows format window to format the drive.
_
Private Shared Function SHFormatDrive(ByVal hwnd As IntPtr, ByVal drive As UInteger, ByVal fmtID As UInteger, ByVal options As UInteger) As UInteger
End Function
Public Enum SHFormatFlags As Integer
SHFMT\_ID\_DEFAULT = &HFFFF
SHFMT\_OPT\_FULL = &H1
SHFMT\_OPT\_SYSONLY = &H2
SHFMT\_ERROR = &HFFFFFFFF
SHFMT\_CANCEL = &HFFFFFFFE
SHFMT\_NOFORMAT = &HFFFFFFD
End Enum
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
Dim ret = SHFormatDrive(Me.Handle.ToInt64, _
drvToFormat, _
CUInt(SHFormatFlags.SHFMT_ID_DEFAULT), _
0)
msgbox(ret.tostring)
End Sub
It appears Windows format option to format the drive but I want that when I click on start button, it start formatting rather than displaying another window to format drive. Tell me what should I do. Thanks. Gagan