?
Solved

CD Identify ??

Posted on 1998-08-04
5
Medium Priority
?
246 Views
Last Modified: 2010-04-04
Hi...
I write a CD-Player Software in Delphi 3. I also want to add a feature, where you can assign Title Names to each Track and the Player saves it. So my problem is, is there away to detect what CD is inserted, i mean like a serial number ?
0
Comment
Question by:omsec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
pjdb earned 20 total points
ID: 1359693
You can retireve the disk serial number with GetVolumeInformation. They are unique (I haven't two CD with the same value). I know some CD player that use this number, so it should work.

JDB

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359694
Hi omsec,

To get the volume name :

function TCDEvents.GetVolumeName(vDrive: Char): String;
var MaximumComponentLength : dWord;
    FileSystemFlags : dWord;
    VolumeName : String;
    i : integer;
begin
 SetLength(VolumeName, 64);
 GetVolumeInformation(PChar(vDrive+':\'),
                      PChar(VolumeName),
                      Length(VolumeName),
                      nil,
                      MaximumComponentLength,
                      FileSystemFlags,
                      nil,
                      0);
 Result := VolumeName;
end;

To get some other information :

function TCDEvents.GetCDInfo(vWord:Word):String;
var msp : TMCI_INFO_PARMS;
    MediaString : array[0..255] of char;
    ret : longint;
begin
 FillChar(MediaString, SizeOf(MediaString), #0);
 FillChar(msp, sizeof(msp), #0);
 msp.lpstrReturn := @MediaString;
 msp.dwRetSize := 255;
 ret := mciSendCommand(ID,
                       MCI_INFO,
                       vWord,
                       longint(@msp));
 if Ret <> 0 then begin
   MciGetErrorString(ret, @MediaString, SizeOf(MediaString));
   Result := StrPas(MediaString);
 end else Result := StrPas(MediaString);
end;

function TCDEvents.GetSerialNumber: string;
begin
 Result := GetCDInfo(MCI_INFO_MEDIA_IDENTITY);
end;

function TCDEvents.GetUPCNumber: string;
begin
 Result := GetCDInfo(MCI_INFO_MEDIA_UPC);
end;

function TCDEvents.GetProductInfo: string;
begin
 Result := GetCDInfo(MCI_INFO_Product);
end;

Well, this code comes directly from my freeware component cdevents. I'm sure you've seen it around at some places (torries). So, maybe you can check my component out? Any ideas, bugs are welcome.

Zif.
0
 
LVL 2

Author Comment

by:omsec
ID: 1359695
hmh...who deserved the points now ? :P

I'll check out your Compo when I have the URL...
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359696
hi omsec,

you can find cdevents now also at our own brand-new site! (remember shared effort?). Here is the link :
http://www.delphi.magsoft.com.pl/Download/cdevents.zip

Regards, Zif.
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1359697
who deserved the points now ?
The one that help you most.... it's yours to decide

JDB
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question