|
-
Oct 10th, 2000, 11:43 AM
#1
Thread Starter
Lively Member
Multiple CD w/drive check
Ok let me see, the easiest way to explain this would be: I have created a family tree program, when you click on the persons name it pops up a form that has info on that person. What I want to do is add a (view photos) button that the individual using the program clicks and when they do the program accesses the cd rom and opens the album program for the individual they are reading about. The problem I have is all the pictures wont fit on one disk there are 3. I need to when you push the view photos button it looks for the cd drive(just in case the cd isnt d) then looks for the right album and if it doesnt find it to give a message box to put the right cd in (like "Please Place CD 3 in the CD Drive") and then check again when they push OK in the message box and open the album!!!! That is it any help would be GREATLY appreciated!!!!
-
Oct 10th, 2000, 01:45 PM
#2
Junior Member
Put this in a module:
Public CdDrive as string
Public Const DRIVE_CDROM& = 5
Public Const DRIVE_FIXED& = 3
Public Const DRIVE_REMOVABLE& = 2
Public Declare Function GetDriveType& Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String)
Sub FindCDdrive()
Dim i, Drv, D$
For i = 0 To 25
D$ = Chr$(i + 65) & ":"
Drv = GetDriveType(D$)
Select Case Drv
Case DRIVE_CDROM
CdDrive =D$
Case Else
End Select
Next i
Now, if the album is some sort of file, you can use the Filelen function to determine if this file is on the CD:
If Filelen(CdDrive & "\albumfile.???")>0 then
'this is the right album
Else
msgbox "Please insert the correct CD"
End if
I hope this will help, but I'm only an amateur programmer, so this probably won't be professional code.
Dave.
-
Oct 10th, 2000, 08:48 PM
#3
Thread Starter
Lively Member
Multiple CD w/drive check
Thanks Harmough, Ill try that I appreciate it since your the only one to reply!!!
-
Oct 12th, 2000, 09:47 AM
#4
Thread Starter
Lively Member
Attn Harmough
Ok Harmough (David) I hate to pester you but since you are the only one that will help me. Ill let u in on a little secret! I have very little programming experience. All I have is self taught and I have More VB5 for Dummies and Sam teaches VB6 in 24 hours. I have VB 5 Professional (a very expensive christmas gift!!!) So now with my problem!!!! I inserted your code (below) in a standard module
Put this in a module:
Public CdDrive as string
Public Const DRIVE_CDROM& = 5
Public Const DRIVE_FIXED& = 3
Public Const DRIVE_REMOVABLE& = 2
Public Declare Function GetDriveType& Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String)
Sub FindCDdrive()
Dim i, Drv, D$
For i = 0 To 25
D$ = Chr$(i + 65) & ":"
Drv = GetDriveType(D$)
Select Case Drv
Case DRIVE_CDROM
CdDrive =D$
Case Else
End Select
Next i
Here I put this (below) here in the button click command on my form. With your notes as 'notations
the problem I have is that it gives me a mistype error on the (CdDrive & "\setup.exe") it highlights the & sign.
Oh i named the module CdDrive is that what I was suppose to do?
Now, if the album is some sort of file, you can use the Filelen function to determine if this file is on the CD:
If Filelen(CdDrive & "\albumfile.???")>0 then
'this is the right album
Else
msgbox "Please insert the correct CD"
End if
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
|