|
|
![]() |
|
|
Top | #1 |
|
Not Too eXPerienced
Joined: June 2002
Posts: 208
Reputation: 30
Power: 120 |
first - a program that ejects the CD Tray second - a program that loads the CD Tray Please take note that there will be no command buttons to click when the .exe file is created, once the exe file is double clicked it automatically executes its purpose. thanks for any extended help..... |
|
|
|
|
|
Top | #2 |
|
OSNN Veteran Addict
Joined: June 2002
Location: Amstelveen, The Netherlands
Posts: 2,846
Reputation: 120
Power: 147 |
Code:
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
Private Sub Form_Load()
Call mciSendString("Set CDAudio Door Open Wait", 0&, 0&, 0&)
Unload Me
End Sub
|
|
|
|
|
|
Top | #3 |
|
OSNN Addict
Joined: August 2002
Location: Kansas
Posts: 88
Reputation: 20
Power: 116 |
It took me awhile to get this one... it will compile into one exe but does both open and close the cd tray. Sorry I didn't read the request, you wanted two programs. Oh well.
Code:
'vb 6
Option Explicit
Dim mssg As String * 255
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
Private Sub Form_Activate()
Form1.Visible = False
End Sub
Private Sub Form_Load()
'open connection to cdaudio device
Call mciSendString("open cdaudio alias cd1", 0, 0, 0)
'check the status of the cdaudio divice
Call mciSendString("status cd1 mode", mssg, 255, 0)
'if the door is open, close it other wise open it
If Left(mssg, 4) = "open" Then
Call mciSendString("set cd1 door closed wait", 0, 0, 0)
Else
Call mciSendString("set cd1 door open wait", 0, 0, 0)
End If
'close the connection to the cdaudio device
Call mciSendString("close cdaudio alias cd1", 0, 0, 0)
Unload Me
End Sub
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help with visual basic 6 | saithe | Web Design & Coding | 1 | December 28th, 2005 7:20am |
| Visual Basic 6 – Drawing Code Help | indyjones | Web Design & Coding | 3 | February 19th, 2005 11:46am |
| Visual Basic Code | NLM | Web Design & Coding | 4 | April 18th, 2003 3:47am |
| Visual Basic | JJH35 | Web Design & Coding | 2 | January 31st, 2003 3:41pm |
| Visual Basic 6.0 | rickang | Web Design & Coding | 1 | March 21st, 2002 2:22am |