Hey people,
I have no real knowledge in programming however I am trying to learn... I am trying to integrate the following code from a project I found online.
The code is used to detect multiple cd drives and have them listed in a combo box. What I would like to do is remove the combo box and have the program select the only cd drive available (My computer only has one). I have no idea how to do this, I have tried all sorts of methods and google searches and nothing has come up. Any help will be greatly appreciated! THANKS
The code which is associated with errors once I remove the combo box from the view designer:
Snippet One:
'
' Determine the current recording devices
'
Dim discMaster As MsftDiscMaster2 = Nothing
Try
discMaster = New MsftDiscMaster2()
If discMaster.IsSupportedEnvironment = False Then Return
Dim uniqueRecorderId As String
Dim discRecorder2 As MsftDiscRecorder2
For Each uniqueRecorderId In discMaster
discRecorder2 = New MsftDiscRecorder2()
discRecorder2.InitializeDiscRecorder(uniqueRecorderId)
devicesComboBox.Items.Add(discRecorder2)
Next
End If
Snippet Two:
Dim discRecorder2 As MsftDiscRecorder2
For Each discRecorder2 In devicesComboBox.Items
If discRecorder2 IsNot Nothing Then
Marshal.ReleaseComObject(discRecorder2)
End If
Next
Snippet Three:
Dim discRecorder As MsftDiscRecorder2 = CType(devicesComboBox.Items(devicesComboBox.SelectedIndex), MsftDiscRecorder2)
Snippet Four:
Dim discRecorder As IDiscRecorder2 = CType(devicesComboBox.Items(devicesComboBox.SelectedIndex), IDiscRecorder2)
_burnData.uniqueRecorderId = discRecorder.ActiveDiscRecorder
I have no real knowledge in programming however I am trying to learn... I am trying to integrate the following code from a project I found online.
The code is used to detect multiple cd drives and have them listed in a combo box. What I would like to do is remove the combo box and have the program select the only cd drive available (My computer only has one). I have no idea how to do this, I have tried all sorts of methods and google searches and nothing has come up. Any help will be greatly appreciated! THANKS
The code which is associated with errors once I remove the combo box from the view designer:
Snippet One:
'
' Determine the current recording devices
'
Dim discMaster As MsftDiscMaster2 = Nothing
Try
discMaster = New MsftDiscMaster2()
If discMaster.IsSupportedEnvironment = False Then Return
Dim uniqueRecorderId As String
Dim discRecorder2 As MsftDiscRecorder2
For Each uniqueRecorderId In discMaster
discRecorder2 = New MsftDiscRecorder2()
discRecorder2.InitializeDiscRecorder(uniqueRecorderId)
devicesComboBox.Items.Add(discRecorder2)
Next
End If
Snippet Two:
Dim discRecorder2 As MsftDiscRecorder2
For Each discRecorder2 In devicesComboBox.Items
If discRecorder2 IsNot Nothing Then
Marshal.ReleaseComObject(discRecorder2)
End If
Next
Snippet Three:
Dim discRecorder As MsftDiscRecorder2 = CType(devicesComboBox.Items(devicesComboBox.SelectedIndex), MsftDiscRecorder2)
Snippet Four:
Dim discRecorder As IDiscRecorder2 = CType(devicesComboBox.Items(devicesComboBox.SelectedIndex), IDiscRecorder2)
_burnData.uniqueRecorderId = discRecorder.ActiveDiscRecorder