Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDs have a unique ID ?? 1

Status
Not open for further replies.

bclt

Programmer
Mar 13, 2005
363
GR
I think they have an ID (don't care if it's unique)...
Is there any way to get the ID of the inserted CD with a vb routine ?


Tnx
 
CDs have no unique ID. When the format was created in 1982, no one had any idea that you might want to stick one in a computer.

Sorry.

CDDB and a few others have an algorithm that examines the track info, but it's a pretty bad algorithm -- there's lots of collisions, especially amongst CD singles (I have a few CD promos that come up with 10+ hits).

The fact that someone keeps using the wrong genre (usually "Folk", as it's the one with genre ID 0) to identify music is a separate issue that drives me insane...

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
If not from a CD how can i get the serial number of a disk ?

Tnx
 
Take it out and look at it? I'm assuming you are talking about the numbers/barcode on the inner ring of the CD. So far as I know, there is no way to make a CD Rom drive read that.

-Rick

----------------------
[banghead]If you're about to post an ASP.Net question,
please don't do it in the VB.Net forum[banghead]

[monkey] I believe in killer coding ninja monkeys.[monkey]
 
Right, now i'm talking about how to get e.g. drive's "c:" serial number ...programmatically rather than having to get the disk in my hands :)

-
 
To get a disk serial number, try this (you need to add a System.Management reference for VB.NET; var will contain the ID):

Code:
Imports System.Management

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        GetVolumeSerialNumber("C")
    End Sub
    Public Function GetVolumeSerialNumber(ByVal driveletter As String) As String
        Dim var        
        Dim mobjSearcher As New ManagementObjectSearcher _
        ("SELECT * FROM Win32_LogicalDisk WHERE Name = '" & driveletter & ":'")
        For Each obj As ManagementObject In mobjSearcher.Get
            'Return obj("VolumeSerialNumber")
            [b]var[/b] = obj("VolumeSerialNumber")
        Next
    End Function

__________________________________________
Try forum1391 for lively discussions
 
Right, now i'm talking about how to get e.g. drive's "c:" serial number ...programmatically rather than having to get the disk in my hands :)

Please don't change the subject in the middle of a thread. You asked about CDs, not hard drives.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top