Solved

CD Identify ??

Posted on 1998-08-04
5
245 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 10 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
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…

690 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