|
-
May 8th, 2002, 03:26 PM
#1
Thread Starter
New Member
Media in the CD rom Drive
Hey there, Not even sure if this is the right forum but here it goes.
I have a program that looks up a file name based on index fields in a database. That part I got to work great. The problem is that the imagefiles are CD's , 50 of them. When the user looks for the image name and double clicks it I got it so that if the right CD is in there, it will open the file in the application with SheelExecute, what I want to know is how can I prompt the user for the correct media?
My table is as follows
Box# (index field)
Folder# (index Field)
CD
Image Name
Any help is appreciated
Dave
-
May 8th, 2002, 03:32 PM
#2
-= B u g S l a y e r =-
u want to throw a msgbox at the user until he inserts a cd and its the correct cd ? is that it?
-
May 8th, 2002, 03:35 PM
#3
Thread Starter
New Member
Yea.. I found the way to detect which drive is the CD rom drive I want to know if there is a way to detect the CD-ROM name in the drive. So if CD1 is in there, and looking for a file on CD35 it will detect that CD1 is in there, throw up a MSGBOX saying put in CD35 and then wait for the CD to be put in.
Dave
-
May 8th, 2002, 04:15 PM
#4
Lively Member
declare a variable of type
FileSystemObject (include a reference to microsoft scripting runtime )
Dim fso as new FileSystemObject
then see the property .drives
fso.Drives(a_letter_or_a_number).VolumeName
it will give you the name of the CD ....
so
if fso.Drives(a_letter_or_a_number).VolumeName = "CD1" then
msgbox "This is the right CD"
else
msgbox "Wrong, bad CD"
end if
-
May 8th, 2002, 04:44 PM
#5
Hyperactive Member
Why not check the cd serial?
VB Code:
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
Public Function GetSerial(StrDrive As String) As Long
Dim Serial As Long
GetVolumeInformation StrDrive, dummy, 255, Serial, 0, 0, dummy2, 255
GetSerial = Serial
End Function
Visual Baisc 6 (SP5)
Windows Xp
-
May 8th, 2002, 07:33 PM
#6
The simplest way (or the most complex way, depending on your point of view) would be to have an Index file on your CD that has the list that can be selected.
The Index file would know what CD contains that information, and prompt the user appropriately.
-
May 8th, 2002, 07:35 PM
#7
Originally posted by ZeroCool
Why not check the cd serial?
VB Code:
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
Public Function GetSerial(StrDrive As String) As Long
Dim Serial As Long
GetVolumeInformation StrDrive, dummy, 255, Serial, 0, 0, dummy2, 255
GetSerial = Serial
End Function
I hate when apps use the Serial for a CD because I sometimes will switch CD's during the course of running the app and most of those programs just bomb when I do.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
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
|