Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Open/close CD door


'Declare
Declare Function mciSendString Lib "winmm.dll <API_WINMM.html>" Alias _
    "mciSendStringA" ( ByVal lpstrCommand As String , ByVal _
   lpstrReturnString As String , ByVal uReturnLength As Long , _
    ByVal hwndCallback As Long ) As Long


'to open the CD
Dim res As Long , returnstring As String * 127
res = mciSendString( "set CDAudio door open" , returnstring, 127, 0)

'to close the CD
Dim res As Long , returnstring As String * 127
res = mciSendString( "set CDAudio door closed" , returnstring, 127, 0)