|
-
Aug 2nd, 2001, 10:18 AM
#1
Thread Starter
Hyperactive Member
Opening/Closeing CD tray 1/2 or browseing
I'm trying to do something, and when the user clicks on the open button it well load up a dialog box (that I made) that well ask if the user what's to open his/her CD tray 1 or 2 (if they have 2 cd drives) and one the let's them browse there computer for media files (mpg, avi, mp3, etc.). this is what I got so far:
Look at next post for the picture.
All I need now is the code for doing that and how to I do a form load thing that well scan there drive(s) for the name of the CD drive(s) and howmany there, and if it scans and finds only one, it well hide option2 showing a message that reads "No second CD Drive found" and if it finds the name it well say something like (by the option thing replaceing "Open/Close CD Tray 1" with "Open/Close *name of CD Drive*"):
Open/Close *Name of CD Drive*
Thank you a head of time.
Last edited by scsa20; Aug 2nd, 2001 at 10:22 AM.
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
-
Aug 2nd, 2001, 10:21 AM
#2
Thread Starter
Hyperactive Member
since the link didn't worked (for some reason) when you click on it to see what it looks like, I just added it as a attachment (alot easyer).
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
-
Aug 2nd, 2001, 06:53 PM
#3
Thread Starter
Hyperactive Member
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
-
Aug 2nd, 2001, 07:07 PM
#4
PowerPoster
-
Aug 2nd, 2001, 07:59 PM
#5
Fanatic Member
Once you know what the drive letters are for the various CD drive(s) on the system (all that info is in those 3 links), this can be used to open or close those doors.
VB Code:
'in a module
Public Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal lpzCommand As String, ByVal lpzReturn As String, ByVal nReturnLength As Long, ByVal hWndCallback As Long) As Long
Public Sub DriveDoor(ByVal strDriveLetter As String, Optional ByVal blnOpenDoor As Boolean = True)
'tells the MCI to ready the device and nickname it "dooralias"
mciSendString "open " & strDriveLetter & ": type cdaudio alias dooralias", vbNullString, 0, 0
'opens/closes the given drive door based on the boolean flag
mciSendString "set dooralias door " & IIf(blnOpenDoor, "open", "closed"), vbNullString, 0, 0
'tells MCI that we're done with the device
mciSendString "close dooralias", vbNullString, 0, 0
End Sub
'to open the door of drive X
DriveDoor "x", True 'true is assumed, and may be left out
'to close the door of drive X
DriveDoor "x", False
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
-
Aug 2nd, 2001, 08:15 PM
#6
Hyperactive Member
Heres how to get the drive letters
VB Code:
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
Const DRIVE_CDROM = 5
Private Sub Command1_Click()
Dim tmp As Integer
Dim tmpStr As String
Dim Drives As String
Dim CDsCount As Integer 'Number of CD Drives
Dim CDsLetters As String 'Cd Drive Letters
Drives = Space(255)
ret& = GetLogicalDriveStrings(Len(Drives), Drives)
For tmp = 1 To ret& Step 4
tmpStr = Mid(Drives, tmp, 3)
If GetDriveType(tmpStr) = DRIVE_CDROM Then
CDsCount = CDsCount + 1
CDsLetters = CDsLetters & Left(tmpStr, 1) & " "
End If
Next tmp
If CDsCount Then
MsgBox CDsCount, vbInformation, "Number Of CD Drives"
MsgBox CDsLetters, vbInformation, "Letters Of Drives"
Else
MsgBox "No CDs Available"
End If
End Sub
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
-
Aug 2nd, 2001, 08:17 PM
#7
Hyperactive Member
oops
the MCI SENDSTRING declaration doesn't need to be there LOL i took this from another program i had made hehe
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
-
Aug 2nd, 2001, 11:32 PM
#8
Thread Starter
Hyperactive Member
thanks for the codes and links, I'll try them out.
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
-
Aug 2nd, 2001, 11:56 PM
#9
Thread Starter
Hyperactive Member
Ok, I tryed out the code that AGG and Kaverin give me, but how do I put the code that AGG give me that renames the caption of the first CD Drive in the first Option slecte and renames the caption of the second CD Drive in the second Option slecte?? Plus how do I use the code that Kaverin gived me for opening the first cd drive (when slected) and for opening the second cd drive (when slected) and for opening up a browse screen that lets you look for mpgs, avis, mp3, etc. (when slected)??
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
-
Aug 3rd, 2001, 03:47 AM
#10
Thread Starter
Hyperactive Member
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
-
Aug 3rd, 2001, 03:53 AM
#11
-
Aug 3rd, 2001, 08:04 PM
#12
Thread Starter
Hyperactive Member
it says it can't find the page (well...that what I get)
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
-
Aug 3rd, 2001, 10:47 PM
#13
Thread Starter
Hyperactive Member
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
-
Aug 3rd, 2001, 10:57 PM
#14
Registered User
Something like the app attached?
-
Aug 3rd, 2001, 11:24 PM
#15
Thread Starter
Hyperactive Member
hey, thanks. Now I can actly look at a program that has that list thing and take a look at it and brak it down to fit in my program I'm making.
p|-|34|2 /\/\3 f0|2 | $p34k 1337 
My TSS quote of the day: "If your haveing a bad day, just press the restart button."
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
|