song
May 21st, 2001, 04:10 AM
Is there any function to get CD-ROM's label?
|
Click to See Complete Forum and Search --> : How to get CD-ROM's label song May 21st, 2001, 04:10 AM Is there any function to get CD-ROM's label? cksiow May 21st, 2001, 04:30 AM try Debug.Print Dir("f:", vbVolume) where f: is your cdrom drive HTH cksiow http://vblib.virtualave.net - share our codes song May 21st, 2001, 04:44 AM Thank you for your reply, but I am not very fimilar with VB, I copy the code you told me, then run it. There are something wrong with the sentence : Debug.Print Dir("f:", vbVolume). It is said that "Debug" is a invalid outside procedure. Do I have to write other code before run it? Thank you cksiow May 21st, 2001, 04:47 AM ok do it this way, put a label in your form called it label1, then in your form load event procedure put this Private Sub Form_Load() label1.caption = Dir("f:", vbVolume) End Sub HTH song May 21st, 2001, 05:04 AM Do you test the code on your computer? why it doesn't work in my program. I do as you told me, but label1.caption ="" after execute the sentence label1.caption = Dir("f:", vbVolume) Bother you to check it again! Cimperiali May 21st, 2001, 05:13 AM Code is ok, provided you cd - rom is volume f. Matter is: you get back an empty string if volume has no label... Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus. Cimperiali May 21st, 2001, 05:17 AM You may want to try with api: (from api-guide - download this: it will help you a lot in the future) Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long Private Sub Form_Load() 'KPD-Team 1998 'URL: http://www.allapi.net/ 'E-Mail: KPDTeam@Allapi.net Dim Serial As Long, VName As String, FSName As String 'Create buffers VName = String$(255, Chr$(0)) FSName = String$(255, Chr$(0)) 'Get the volume information 'change "c:\" to your Cd-rom letter GetVolumeInformation "C:\", VName, 255, Serial, 0, 0, FSName, 255 'Strip the extra chr$(0)'s VName = Left$(VName, InStr(1, VName, Chr$(0)) - 1) FSName = Left$(FSName, InStr(1, FSName, Chr$(0)) - 1) MsgBox "The Volume name of C:\ is '" + VName + "', the File system name of C:\ is '" + FSName + "' and the serial number of C:\ is '" + Trim(Str$(Serial)) + "'", vbInformation + vbOKOnly, App.Title End Sub Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus. cksiow May 21st, 2001, 09:26 AM you should replace f: with your own cdrom drive. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |