Solved

Check CDROM has a cd in it

Posted on 2001-09-04
6
174 Views
Last Modified: 2013-12-03
i have a function in VB to get all cd rom drives and list them, how can i make sure it has a cd in it before listing all files etc?
0
Comment
Question by:Kunt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 6456608
Hi Kunt,

you could simply call some function which fails if no cd is in drive, i.e. GetDiskFreeSpace.

ZOPPO
0
 

Author Comment

by:Kunt
ID: 6459119
yeh, thats what i already do, i was wondering if there is nice tidy function for it?
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 6459768
well, I didn't find an extra function for this ... some samples use something like

HANDLE  hCD;
hCD = CreateFile ("\\\\.\\F:", GENERIC_READ,
 FILE_SHARE_READ|FILE_SHARE_WRITE,
 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
 NULL);
if (hCD != INVALID_HANDLE_VALUE)
{
 // ok, disk in drive...
}
CloseHandle (hCD);

further I found you can handle message WM_DEVICECHANGE which is sent
to top-level windows whenever a disk is inserted/removed and some other
reasons.

ZOPPO      
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10680069
PAQed, with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

623 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