Du bist hier: Snippet-Verzeichnis » Visual Basic (78)
Sprache:

CD-DRIVE TRAY OUT/IN

Sprache: English
Programmiersprache: Visual Basic
Veröffentlicht von: romeo_77p [nicht registriert]
Letzte Änderung: 15.05.2006
Aufrufe: 1189


Beschreibung

This is a small and simple but very useful progy to use if you make a program that requires a CD. You can check if the CD in the drive is the one you want. If not you can throw it out to the user to give you the correct one. Cool!Good especially with a game on more than one CD's.Just make a couple of buttons. One cmdTrayIn and the other cmdTrayOut and paste this code to test it.It uses an API function. I've checked it with VB 6.0 only. Guess it will work with others too if you have the API function in that one too. If you are using an earlier version, then try to check the syntax and correct it your self. Any suggestions just mail me.

Code

1 Private Declare Function mciSendString Lib "winmm.dll" _ 2 Alias "mciSendStringA" _ 3 (ByVal lpstrCommand As String, _ 4 ByVal lpstrReturnString As String, _ 5 ByVal uReturnLength As Long, _ 6 ByVal hwndCallback As Long) As Long 7 8 Private Sub cmdTrayOut_Click() 9 x = mciSendString("set CDAudio door open", 0&, 0, 0) 10 End Sub 11 12 Private Sub cmdTrayIn_Click() 13 x = mciSendString("set CDAudio door closed", 0&, 0, 0) 14 End Sub 15

Noch kein Kommentar vorhanden

Dieses Snippet kommentieren

Name *  

E-Mail (wird nicht angezeigt) *    

Website  

Kommentar *  

Sicherheitscode Sicherheitscode *    

RSS