>Codigos

Como abrir y cerrar la lectora de windows desde visual basic.net

 Pasos:
-Agregar 2 botones, uno sera el boton "abrir" y el otro el boton "cerrar".

Abrir lectora de windows con visual basic.net


Codigo fuente:


Public Class Form1
        Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
    Dim ret As Integer

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            ret = mciSendString("Set CdAudio Door Open Wait", vbNullString, 127, 0)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Try
            ret = mciSendString("Set CdAudio Door Closed Wait", vbNullString, 127, 0)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class 


No hay comentarios:

Publicar un comentario