source code open & close cdrom

Upload: gilang-on-wp

Post on 01-Mar-2016

217 views

Category:

Documents


0 download

DESCRIPTION

VB6

TRANSCRIPT

  • 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

    Function CDDriveOperation(ByVal Command As String, ByVal hWnd As Long) As String Dim Buff As String Dim dwR As Long Buff = Space$(100) ' Create a buffer dwR = mciSendString(Command, ByVal Buff, Len(Buff), hWnd) CDDriveOperation = BuffEnd Function

    'Call this Sub to Close the CD DoorPrivate Sub CloseCDDoor() Dim ret As String ret = CDDriveOperation("set cdaudio door closed", 0)End Sub

    ' Call this Sub to Open the CD DoorPrivate Sub OpenCDDoor() Dim ret As String ret = CDDriveOperation("set cdaudio door open", 0)End Sub