ok i wanted to make a button to open/close the CD tray i have the code to do it but when i compile it nothing happens could somebody please tell me what i did wrong.Code:Public Class Form1 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 = Buff End Function 'Call this Sub to Close the CD Door Private Sub CloseCDDoor() Dim ret As String ret = CDDriveOperation("set cdaudio door closed", 0) End Sub ' Call this Sub to Open the CD Door Private Sub OpenCDDoor() Dim ret As String ret = CDDriveOperation("set cdaudio door open", 0) End Sub End Class




Reply With Quote