Another way to eject a CD

This is another way to easily eject CD in only 5 line of code.

Private Sub Form_Load()
Call eject
End Sub

Public Sub eject()
'code to eject cdrom ok
Dim owmp As Object
Dim colCDROMs
Set owmp = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = owmp.cdromCollection
If colCDROMs.Count >= 1 Then
For i = 0 To colCDROMs.Count - 1
colCDROMs.Item(i).eject
Next
End If
End Sub

0 comments:

Post a Comment