Solved

CD ID Code

Posted on 1998-09-06
3
157 Views
Last Modified: 2012-05-04
How can i read the id code on a cd, i want to use it to positivly identify each different cd placed in the computer.
0
Comment
Question by:spat
[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
3 Comments
 
LVL 4

Accepted Solution

by:
itamar earned 100 total points
ID: 1338828
Hi spat,

the following function is a modification of the original one from Andrea Mennini component TVolumeInformation:

{*****************************************************************************
  function GetVolumeSerialNumber - Gets the Volume serial number for the
                                   specified drive.

  Input parameters: Drive Letter (Example: 'D:'
  Output parameters: The function returns a string containing the volume serial
                     number, or an empty string if some error occurs.
 *****************************************************************************}
function GetVolumeSerialNumber(Drive: string): string;
var
  OldErrorMode: Integer;
  NotUsed, VolFlags: Integer;
  VolSN: DWORD;
  VolumeSerialNumber: string;
  Error: boolean;
begin
  OldErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS);
  try
    //SetUNCDrive;
    Error := GetVolumeInformation(PChar(Drive),
                                  nil,
                                  0,
                                  @VolSN,
                                  NotUsed,
                                  VolFlags,
                                  nil,
                                  0);

    if (Error = False) then
    begin
      //ProcessError(Result);
      Exit
    end;

    VolumeSerialNumber := AnsiUpperCase(IntToHex(VolSN, 8));
    Result := Copy(VolumeSerialNumber, 1, 4) + ':' +
              Copy(VolumeSerialNumber, 5, 4);
  finally
    SetErrorMode(OldErrorMode);
  end;
end;


If you want, I can send you the component with source code. It's freeware and free distribution.
A very usefull tool. Just place a comment with your e-mail, or send an e-mail to:

itamar@facil.com

Regards,
Itamar
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1338829
Hello spat! Whould you please grade Itamars' great answer so we can remove some unnecessary Qs from this pile ;->

//Vik
0
 
LVL 4

Expert Comment

by:itamar
ID: 1338830
I would apreciate too ;)
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

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 80
FMX and jaudiotracker playing memory stream 29 98
DBCtrlGrid, Delphi, Scroll 7 33
Connect to SQL 2008 r2 server over the Internet 4 23
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 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