DVD Ejector in VB


Its a great time for a software programmers to control their system by them self.For doing this i step towards for developing the small software the DVD Ejector.Using this following piece of code you can create a software to eject your dvd or/cd drive to open and close.
// Comment
Public Class frmEject
    'you need window media player reference in your project
    '1 combo box
    ' 2 button control
    Dim omal As New WMPLib.WindowsMediaPlayer
    Dim total As Integer
    Dim i As Integer

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        omal.close()
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        total = 0
        i = 0
        total = omal.cdromCollection.count
        If (total >= 1) Then
            For i = 0 To (total - 1)
                ComboBox1.Items.Add(omal.cdromCollection.Item(i).driveSpecifier)
            Next
            ComboBox1.Text = ComboBox1.Items.Item(0)
        End If
        MyBase.CenterToScreen()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not (ComboBox1.Text = "") Then
            omal.cdromCollection.Item(ComboBox1.SelectedIndex).eject()
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        For i = 0 To (total - 1)
            omal.cdromCollection.Item(i).eject()
        Next
    End Sub
End Class


raja P Web Developer

3 comments:

  1. Ejector Sleeves Manufacturers
    "MATI is truly a one-stop shopping source for the molding and mold making industries, offering sleeves, ejector sleeves, Ejector blade, Ejector pin & Punches in India."


    For more details log on to :- http://matiworld.in/

    ReplyDelete
  2. Ejector Pin Manufacturers

    "MATI is truly a one-stop shopping source for the molding and mold making industries, offering ejector sleeves, Ejector blades, Ejector pins, Step ejector pins, Core pins & Punches in India."



    for more details
    please contact
    http://www.matiworld.in/

    ReplyDelete
  3. "MATI is truly a one-stop shopping source for the molding and mold making industries, offering ejector sleeves, Ejector blades, Ejector pins, Step ejector pins, Core pins & Punches in India."


    for more details
    please contact
    http://www.matiworld.in/

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...