Solved

Drive empty

Posted on 1998-06-25
2
182 Views
Last Modified: 2010-05-03
I want to check my CD ROM drive is EMPTY or not
if EMPTY prompt error !
0
Comment
Question by:hateli
2 Comments
 
LVL 2

Accepted Solution

by:
swilt earned 10 total points
Comment Utility
Try this bit of code

Option Explicit

Private Sub Form_Load()
    Dim x As Integer
   
    x = nCheckDrive("e:")
    If x = 0 Then
        MsgBox "Disk in drive"
    Else
        MsgBox "No Disk in drive"
    End If
End Sub

Private Function nCheckDrive(ByVal sDrive As String) As Integer
    On Error GoTo EHDrive
   
    Dim nErrNum As Integer
   
    nErrNum = 0
    Dir$ sDrive
    nCheckDrive = nErrNum
    Exit Function
   
EHDrive:
    nErrNum = Err.Number
   ' MsgBox Err.Description
    Resume Next
End Function

0
 
LVL 6

Expert Comment

by:clifABB
Comment Utility
swilt:
An excellent solution.  Without even using the API!
My hats off to you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now