C#, NeroDrive, Eventhandlers



OK, I’m stumped trying to get this happening.

Situation: C#, using the NeroCOM interface. I create Nero, NeroDrives, and NeroDrive objects without a problem. I can pull data from NeroDrives using the standard nero.GetDrives(). However, I run into a Catch-22 trying to access a particular drive.

If I use the syntax: drive = (NeroDrive)drives.Item(0); I get a runtime cast exception error.

If I build w/o the cast, I get a compile-time error saying cannot implicitly cast NEROLib.INeroDrive to NEROLib.NeroDrive.

If I declare drive as INeroDrive, the assignment is fine, but I can’t assign event handlers since INeroDrive doesn’t have them.

Any suggestions? Would _INeroDriveEvents_SinkHelper be of any use?

Finally, can anybody explain the difference (and proper use) of INeroxxxxx and Neroxxxxx?




Hi Tom,
There should be an interface named _INeroDriveEvents_Event, which declares the events of INeroDrive. You can just typecast your “drive” variable to _INeroDriveEvents_Event and assign your event handlers.
Note that I’m not as familiar with the Nero SDK as I’m with COM Interop, so I might be wrong.
Ianier Munoz


excellent suggestion. I cast the drive variable and life is good - assigned event handlers and now have something working.


it is so good to have Nero SDK Discussion Forun,and so is Nero SDK,


I am having a similiar problem. I use VB.NET. I have created a web service to create an ISO on the fly and return it to the client app that is requesting it.

The error I am getting is “Specified cast is not valid.”

This is the Code I am using:

    <WebMethod()> _
    Public Function  testGetImageRecorder() As String
        Dim  nNero As  New NEROLib.Nero
        Dim  nDrives As  NEROLib.INeroDrives
        Dim  nDrive As  NEROLib.NeroDrive

            nDrives = nNero.GetDrives(NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_CDR)
            For Each  nD As  NEROLib.NeroDrive In  nDrives
                If  nD.DeviceName = "Image Recorder" Then
                    nDrive =  CType (nD, NEROLib.NeroDrive)
                    Exit For
                End If
            If  nDrive Is Nothing Then
                Return "No Supported Drives Found"
                Return  nDrive.DeviceName
            End If
        Catch  ex As  Exception
            Return  ex.Message
        End Try
    End Function

Setting nDrive to nD causes the error. When I paste this code into an EXE, it all works… why would I get a cast error in the Web Service and not the EXE?

Please help! After 2 weeks of searching, all my google result links are Purple (visited links)!!!