Click here to Skip to main content
15,897,291 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: SHFormatDrive error Pin
Gagan.207-Mar-10 1:53
Gagan.207-Mar-10 1:53 
GeneralRe: SHFormatDrive error Pin
Eddy Vluggen7-Mar-10 3:33
professionalEddy Vluggen7-Mar-10 3:33 
AnswerRe: SHFormatDrive error [modified] Pin
DaveAuld7-Mar-10 0:53
professionalDaveAuld7-Mar-10 0:53 
GeneralRe: SHFormatDrive error Pin
Gagan.207-Mar-10 1:33
Gagan.207-Mar-10 1:33 
GeneralRe: SHFormatDrive error Pin
DaveAuld7-Mar-10 1:45
professionalDaveAuld7-Mar-10 1:45 
AnswerRe: SHFormatDrive error [Update] Pin
DaveAuld7-Mar-10 3:29
professionalDaveAuld7-Mar-10 3:29 
AnswerRe: SHFormatDrive error Pin
Dave Kreskowiak7-Mar-10 3:43
mveDave Kreskowiak7-Mar-10 3:43 
AnswerRe: SHFormatDrive error Pin
Gagan.207-Mar-10 3:51
Gagan.207-Mar-10 3:51 
When I am using the below code, it appears a Windows format window to format the drive.

<Runtime.InteropServices.DllImport("shell32.dll")> _
        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
GeneralRe: SHFormatDrive error Pin
DaveAuld7-Mar-10 4:09
professionalDaveAuld7-Mar-10 4:09 
GeneralRe: SHFormatDrive error Pin
Gagan.208-Mar-10 2:23
Gagan.208-Mar-10 2:23 
GeneralRe: SHFormatDrive error Pin
DaveAuld8-Mar-10 2:34
professionalDaveAuld8-Mar-10 2:34 
GeneralRe: SHFormatDrive error Pin
Gagan.2013-Mar-10 3:56
Gagan.2013-Mar-10 3:56 
QuestionCopy a whole directory with files and subfolders with progressbar in vb Pin
majan116-Mar-10 17:31
majan116-Mar-10 17:31 
AnswerRe: Copy a whole directory with files and subfolders with progressbar in vb Pin
Luc Pattyn6-Mar-10 18:09
sitebuilderLuc Pattyn6-Mar-10 18:09 
GeneralRe: Copy a whole directory with files and subfolders with progressbar in vb Pin
majan117-Mar-10 11:50
majan117-Mar-10 11:50 
AnswerRe: Copy a whole directory with files and subfolders with progressbar in vb Pin
Gregory Gadow8-Mar-10 6:55
Gregory Gadow8-Mar-10 6:55 
Questionstoring input box values? Pin
toyman78516-Mar-10 13:41
toyman78516-Mar-10 13:41 
AnswerRe: storing input box values? Pin
Scott Dorman6-Mar-10 13:59
professionalScott Dorman6-Mar-10 13:59 
AnswerRe: storing input box values? Pin
Luc Pattyn6-Mar-10 14:39
sitebuilderLuc Pattyn6-Mar-10 14:39 
Questionprinting from file Pin
Daniel Engelkes6-Mar-10 11:35
Daniel Engelkes6-Mar-10 11:35 
QuestionRecognize Multiple keys being pressed Pin
Pugman8126-Mar-10 9:57
Pugman8126-Mar-10 9:57 
AnswerRe: Recognize Multiple keys being pressed Pin
Luc Pattyn6-Mar-10 10:14
sitebuilderLuc Pattyn6-Mar-10 10:14 
Questiontab spacing Pin
Daniel Engelkes6-Mar-10 9:34
Daniel Engelkes6-Mar-10 9:34 
AnswerRe: tab spacing Pin
Luc Pattyn6-Mar-10 10:18
sitebuilderLuc Pattyn6-Mar-10 10:18 
AnswerRe: tab spacing Pin
Dave Doknjas6-Mar-10 10:53
Dave Doknjas6-Mar-10 10:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.