Check for a blank CD-R inserted
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Check for a blank CD-R inserted

  1. #1
    Join Date
    Feb 2003
    Posts
    3

    Question Check for a blank CD-R inserted

    Could anyone give me a clue or some example on how do i check if a blank cd is inserted in my cd/rw drive? I'm trying to write a little program where i punch F1 key, and my cd/rw opens, then msg box says insert a blank cd, then i click ok. Here i need to check if the media inserted is a valid blank cd-r. If not it would spit it out and return to the first msg box. If it's valid cd-r, it would write the specific files (listed in the masterlist file, which would be quite big) onto the cd-r, then spit it out, display message saying it's done. If error during the session, it would spit it out saying error occured, asking if i want to insert another blank cd-r and start over. While copying files to cd-r it would show the progress bar or some kind of animation of the copy process.

    I've got it to the point where it hides the console, opens the cd tray, displays me the msg box to insert a blank cd-r, after clicking on OK it closes the CD/RW, and here i need to check if a cd inserted is a blank and writable cd-r disk (it won't be cd-rw).

    Code:
    #include <iostream> 
    #include <windows.h> 
    #include <mmsystem.h>
    using namespace std;
    
    int open_cd();
    int close_cd();
    
    int main() 
    {
    	FreeConsole();
    	open_cd();
    	MessageBox(NULL, "Insert Blank CD", "Back-up program", MB_OK);
    	
    	close_cd();
    	Sleep(3000);
    	open_cd();
    	MessageBox(NULL, "Done! Remove a CD and click OK", "Back-up program", MB_OK);
    	close_cd();
    
    	return 0;
    }
    
    int open_cd()
    {
    	mciSendString("set cdaudio door open",NULL,0,NULL);
    	return 0;
    }
    
    int close_cd()
    {
    	mciSendString("set cdaudio door closed",NULL,0,NULL);
    	return 0;
    }

  2. #2
    Join Date
    Feb 2003
    Posts
    3

    Unhappy

    Everyone is posting all kind of answers all over this forum and couple more forums that i have searched for last few days, but as of my question - nothing. Searched all these forums with all possible keywords, but can't find anything.

    Posted my question, which I thought at least few gurus would be familiar with, but only views, no replies.

    I guess i'm the first and only person in the world to write the program that requires to check for a blank cd-r inserted.

    I'm really frustrated right now. I don't believe no one knows at least something on this matter.

    Please, if anyone could give me some kind of leads where i could find something related, it would help me alot.

    Thank you.

  3. #3
    Join Date
    Oct 2003
    Posts
    10
    are you using XP?

  4. #4
    Join Date
    Apr 2000
    Location
    Boston
    Posts
    124
    I use IDiscRecorder::QueryMediaType to find if the CD is properly inserted. The returned parameter will tell you if there is a media present and what type.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center