cd dvd drive close event


I'm writing a program to keep my meta music files ,ie the files that contain cd ids and track titles, in sync. eg currently if i rip a cd in musicmatch it does a cddb lookup and stores the info localy on the pc. now if i open itunes and put in the same cd its as though its the first time it had been inserted. i want to share this data between the two applications. anyway i want to trigger this syncing by waiting on the "CD DRIVE DOOR CLOSED" event in windows if there is one. i can then check the relivant files to see which as changed find the new data and put it in the other file, i also plan to share this data over a lan but thats another story

thanks advance jc


  • [b][red]This message was edited by davidbowen1989 at 2007-4-9 4:22:42[/red][/b][hr]
    [b][red]This message was edited by davidbowen1989 at 2007-4-9 4:21:42[/red][/b][hr]
    what are you programming in?

    in delphi i would use the beginthread function to continuoulsy try and open the drive location, using the try and except statements all errors will be ignored, and the except would repeat the loop, if there are no errors, ie there is a CD in the drive the program will resume after the try-except's end;. Make sure it will only run once as well and only start reading agian once there is an error.

    The syntax for beginthread in delphi is a bit hard seen as it is full of windows API. but it goes beginthread(nil, 0, FunctionName, sender, 0, ThreadName);

    The ThreadName must be declared under a global var as cardinal and the thread cannot pass data back via the thread it must go to global variables arrays etc. The thread must also have an EndThread(ThreadName) in the function in case the program ends prematurely, if not the thread will try to access its own program in memory after windows has already "erased" it, basically you get a load of access vialations.

    Well if you dont use delphi im sure you can find out how to do it, but basically give it a try.

    and also its not 4am over here its 12:22pm, im not sad! =]

  • I'm sure the OP is grateful for the quick reply only 3 years after posting. :-) Please check the date of the post you reply to since there is really no use to dig up old, dead threads.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!