Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Cd/dvd Eject
Author:
Michel Renaud
E-mail:
Click to e-mail author
Submitted:
11/30/2007
Version:
VB 2005
Compatibility:
VB 2005, VB 2008
Category:
Multimedia
Views:
16656
Using windows media player to eject media disks.
Declarations:
'none
Code:
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
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement