|
-
May 5th, 2010, 10:11 AM
#12
Addicted Member
Re: [2005] : How to get CD Serial No ?
 Originally Posted by jmcilhinney
Also, here's some slightly cleaner code:
VB Code:
Dim physicalMedia As New ManagementClass("Win32_PhysicalMedia")
Dim mediaType As UShort
Dim serialNumber As String
For Each physicalMedium As ManagementObject In physicalMedia.GetInstances()
mediaType = DirectCast(physicalMedium("MediaType"), UShort)
Select Case mediaType
Case 16 To 19 'CD
serialNumber = CStr(physicalMedium("SerialNumber"))
Case 22 To 26 'DVD
serialNumber = CStr(physicalMedium("SerialNumber"))
End Case
physicalMedium.Dispose()
Next physicalMedium
physicalMedia.Dispose()
i imports System.Management
but ManagementClass("Win32_PhysicalMedia")..?? say not define
is any other classes need to imports..??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|