|
-
May 21st, 2001, 04:10 AM
#1
How to get CD-ROM's label
Is there any function to get CD-ROM's label?
-
May 21st, 2001, 04:30 AM
#2
Re: How to get CD-ROM's label
try
Debug.Print Dir("f:", vbVolume)
where f: is your cdrom drive
HTH
cksiow
http://vblib.virtualave.net - share our codes
-
May 21st, 2001, 04:44 AM
#3
Re: How to get CD-ROM's label
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
-
May 21st, 2001, 04:47 AM
#4
Re: How to get CD-ROM's label
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
-
May 21st, 2001, 05:04 AM
#5
Re: How to get CD-ROM's label
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!
-
May 21st, 2001, 05:13 AM
#6
Re: How to get CD-ROM's label
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.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
May 21st, 2001, 05:17 AM
#7
Re: How to get CD-ROM's label
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: [email protected]
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.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
May 21st, 2001, 09:26 AM
#8
Re: How to get CD-ROM's label
you should replace f: with your own cdrom drive.
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
|