?
Solved

Check CDROM has a cd in it

Posted on 2001-09-04
6
Medium Priority
?
176 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…

719 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