IamWasim

Can anybody tell me how to detect a CDROM or Floppy disc on insertion.

I have tried my hands but failed. I am well aware that this can be done using WMI (Win32 API). The thing is like, my application is in idle state and whenever somebody inserts a disc into the system, my system should detect the disc.

The solution can be in C# or VB.NET




Re: Visual Basic Express Edition Detection of CDROM or Floppy Disc

Andrew DeVaughn

This line of code will check if the path for a floppy disk exists

System.IO.Directory.Exists("A:\")

Here is how to apply it

Sub CheckFloppy()

Dim FloppyReady as boolean

     If system.io.directory.exists("A:\") then

          FloppyReady=true

     Else

          FloppyReady=false

    End If

End Sub

Code is in VB.net 2003