Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Format Removable media with c# programming

Tags:

c#

.net

.net-3.5

I want to format (FAT32) removable drive with c# programming. In the internet I found a way, but the problem is that it opens the generic windows format program. But I want to do it with C# only and no built in windows support.

My method is:

// FAT32 Format Button click event
[DllImport("shell32.dll")]
static extern uint SHFormatDrive(IntPtr hwnd, uint drive, uint fmtID, uint options);
like image 826
Rafayan Avatar asked Jul 13 '10 18:07

Rafayan


1 Answers

You can use wmi, there is a method that allow this.

http://msdn.microsoft.com/en-us/library/aa390432%28v=VS.85%29.aspx

like image 75
Jonathan Avatar answered Sep 22 '22 16:09

Jonathan