Missing Floppy

vgaul

Member
Joined
Jan 29, 2003
Messages
5
Havent seen this problem in the forums. If the solution is there, please point me to it.

I have written an application and distributed it to a few family members. On some machines the application starts out with an error message:

Titlebar: WindowsFormsParkingWindow: myProg.exe - No Disk

There is no disk in the drive. Please insert a disk into Drive A:

(Cancel, Try Again, Continue)

This doesnt occur on all machines--just some. OS doesnt seem to matter: works OK on some XP machines, error on others; works OK on some Win2K machines, error on others.

Unfortunately, none of the machines with errors have VB.Net installed so I cant step through the code.

My code does not reference the floppy at (explicitly) but it does populate a combo box with drive letters using Directory.GetLogicalDrives(). I also use an FSO to get the available drive space, but again never reference the A: drive directly.

Thoughts?

Sidebar: Is there a way to get the available space without FSO thats fairly simple?
 

Attachments

  • error.jpg
    error.jpg
    11.8 KB · Views: 34
Looks like VB6 code. Can all that still be used?

The FSO technique was quick. Is there a problem using FSO in VB? Read somewhere it should only be used in scripts. Could it be causing my problem?
 
Its an API that can be used in any language supporting them (including
.NET).

Here is an example of enumerating all the drives and printing them
and their free spaces:
Code:
    Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, ByRef lpSectorsPerCluster As Integer, ByRef lpBytesPerSector As Integer, ByRef lpNumberOfFreeClusters As Integer, ByRef lpTtoalNumberOfClusters As Integer) As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim drives() As String = IO.Directory.GetLogicalDrives()
    Dim drv As String

    For Each drv In drives
        Dim spc, bps As Long
        Dim free, total As Long
        Dim freeBytes, totalBytes As Long

        GetDiskFreeSpace(drv, spc, bps, free, total)
        freeBytes = spc * bps * free
        totalBytes = spc * bps * total

        ListBox1.Items.Add(drv & "  Space: " & freeBytes & " / " & totalBytes)
    Next
End Sub
 
V.F.

Thanks. API calls were things I never got a good handle on in VB6. Gonna study that link you gave me some more.

One thing Ive learned about programming--the more you learn, the more you realize you dont know.

Thanks for your help.

V.G.
 
Back
Top