check for a CD

Ken Ray kray at sonsothunder.com
Thu Jan 24 09:51:23 EST 2008


On Tue, 22 Jan 2008 10:57:34 -0700, Chris Sheffield wrote:

> The single-user version of our software comes with media content on a 
> series of CDs. Things have been working pretty well, except in a case 
> where a user might have more than one CD drive (we're talking Windows 
> only here). I have written a routine that scans through each 
> available drive looking for our CD. The problem is, if there is no CD 
> in the drive(s) at all, a "no disk" error, generated by Windows, pops 
> up. This error will appear for each drive that does not have a CD in 
> it. My question is, is there some way to suppress this error? I'm 
> simply using a "if there is a file" type of check to determine if our 
> CD is in one of the drives. Is there some other method available to 
> me? A command line utility perhaps?

Well, you can use VBScript to do this, but since it calls on the 
FileSystemObject, it may trigger antivirus/anti-spyware utilities like 
Norton. I ended up writing a VB-based DLL, and then registering it and 
calling it from VBScript to get around this. If you're interested in 
either the VBScript or the DLL, let me know.

I also had an old tip for a command-line app called DriveReady 
(originally it was for checking the existence of floppy disks):

http://www.sonsothunder.com/devres/revolution/tips/disk005.htm

Don't know if it works for CDs though...

How old an OS do you need to support? Can it be XP or Vista, or do you 
need to support older systems?

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list