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 so on.
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;
}