473,467 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Checking the presence of a disc in the drive

vdraceil
236 New Member
Hi friends,i just wanna know whether the presence of a disc in the drive can be detected by coding in vb6.0..if the disc is present i want to perform a set of actions, else i want to display 'insert disc please'..Experts kindly help
Dec 16 '07 #1
2 1812
daniel aristidou
491 Contributor
Hi friends,i just wanna know whether the presence of a disc in the drive can be detected by coding in vb6.0..if the disc is present i want to perform a set of actions, else i want to display 'insert disc please'..Experts kindly help
Hi ... sorry it took a long time but here is the code i belive will work.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Dim Drive As String
  3. Drive = "D:\"
  4. Dim Rename As String
  5. Rename = FileSystem.Dir(Drive, vbVolume)
  6.  
  7. If Len(Rename) = 0 Then
  8.     If MsgBox("There is no Disk Present", vbCritical + vbRetryCancel) = vbRetry Then
  9.         Command1_Click
  10.     End If
  11. Else
  12. MsgBox (Rename & " Is in the Drive")
  13. End If
  14.  
  15. End Sub
Jan 4 '08 #2
Killer42
8,435 Recognized Expert Expert
There's another alternative. Add a reference to Microsoft Scripting Runtime to your project. And add a command button, of course. Then try this...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.   Dim fso As New FileSystemObject
  3.   Dim drv As Drive
  4.   For Each drv In fso.Drives
  5.       Me.Print drv.DriveLetter, drv.DriveType, drv.IsReady
  6.     End With
  7.   Next
  8. End Sub
Jan 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: YT | last post by:
Hello, I am this close | | to throwing myself out the window... I am trying to do a <UL><LI> series and i really really really want the disc size of the list to be nice and small. i've been...
2
by: John Baker | last post by:
Hi: I have an Access application that has been running on my desktop system just fine. I recently tried to move it to my laptop, and on the laptop I get a "Disc or Network Error" message when I...
2
by: Rob | last post by:
Does anyone have any idea of any API that exists, or functions that others have created to find out the start cluster address of any particular file on a FAT32 formatted disc. I dont mind using...
0
by: Johnny Jörgensen | last post by:
Does anybody know how to tell what type of disc that's in the drive currently? I need to be able to distinguish between CD's containing data and Audio CD's Cheers, Johnny J.
2
by: aviraldg | last post by:
Well , could someone tell me how to read/write to a disc drive ? And by disc drive , I mean *disc*drive* , not the files on it. I'm using VC++ 6 , and would prefer the easiest method , even if it...
2
by: joer.banno | last post by:
Hi, In a webapp I'm writing I need to know if another webapp is running (both of which are asp.net), is there a way that you can check for the presence of another webapp? The problem is that...
0
by: =?Utf-8?B?TWFubnk=?= | last post by:
When no disc is in the drive it shows to be a DVD-RW drive but I place a blank DVD-R or Blank DVD+R in the drive is show that a blank CD has been inserted. -- Manny
1
by: =?Utf-8?B?T2FrZGVuZQ==?= | last post by:
I've just bought a new computer and want to load my Office software onto it. The software is on a disc, but the computer doesn't have a disc drive. I've tried loading the disc onto a flash drive...
1
by: =?Utf-8?B?amlt?= | last post by:
Using the normal method my disc check and defragmenter will not work on c drive
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.