Question CD Changer Disc Detection ( CodeGuru Forums Visual C++ Programming ) Updated: 2008-08-12 07:15:09 (7) |
|
CD Changer Disc Detection
I've searched high and low, but have yet to find any method for detecting which disc of a CD changer is currently ready to be accessed. Basically, this sort of detection is important when deciding if it is OK to try accessing a disc which isn't the current one.
For instance, suppose you have a 5 disc changer, with drive letters D through H. Since only one can be accessed at any given time, if a program is using the disc designated as D, then switching to any other would be a bad idea. Simply detecting if the physical drive is being used isn't quite enough, since it is perfectly safe to access the same disc.
Any clues, guesses, or other helpful insight would be greatly appreciated.
|
|
| Answers: CD Changer Disc Detection ( CodeGuru Forums Visual C++ Programming ) |
|
CD Changer Disc Detection
Multitasking is just a part of the problem. You see, let's suppose the user has a changer and a single CDROM or burner. How can a program detect if the disc being accessed is in a changer? Even within my program, more than one disc being accessed at one time is fine if they are two separate physical drives.
WizBang
|
|
CD Changer Disc Detection
Yes. I bet your hardware detects the attempt to read and switches to that CD. Not the best design in the world...
You will need to organize your program to keep track of what you are reading and just hope that nobody trys to multitask and use the CD drive separately.
-Erik
|
|
CD Changer Disc Detection
Well, since there's no custom driver, I figure it must be hardware. Whether the windows CD driver gets involved at some level I don't know.
One trouble with the hook idea, is that the program would need to be running all the time.
WizBang
|
|
CD Changer Disc Detection
Seems to me that you have one of these two suituations:
1. If software controlled, you have a custom driver, then you need to get the API for that driver.
2. If hardware controlled, there is no way to tell. The only thing I can think of is to somehow see which was the last one read from... A hook into the cdfs.sys driver may let you know that, but it is very complicated.
-Erik
|
|
CD Changer Disc Detection
Quote:
|
Originally Posted by WizBang
Simply detecting if the physical drive is being used isn't quite enough, since it is perfectly safe to access the same disc.
|
Ok, I am confused. What is the "same disc"? Why can't you do a disc check?
To do a disc check, use SetErrorMode(SEM_FAILCRITICALERRORS), then call GetVolumeInformation(). You can use GetDriveType() to determine if it is a CD drive.
-Erik
|
|
CD Changer Disc Detection
The problem is, that there are no errors generated. The drive simply switches discs, regardless of whether the current one is being used. So I figure the only way around it is to know in advance which disc is the current one.
WizBang
|
|
CD Changer Disc Detection
Quote:
|
Originally Posted by WizBang
Even within my program, more than one disc being accessed at one time is fine if they are two separate physical drives.
|
Exactly, but it sounds like you are trying to get some kludgy multidisc to one drive thingie going. If there are more than one drive, there isn't a problem, is there?
-Erik
|
|
- Source: - Previous Question: CodeGuru Forums Visual C++ Programming - Next Question: CodeGuru Forums Visual C++ Programming |
|
|