NeroCOM, VB.NET, OnImport2, and SDK 1.05

vbimport

#1

I have just about everything working for Multisession burning in VB .NET. I am having problems using the ImportIsoTrack method of the drive class. I have a global folder defined that I use to build the files I want to burn to a CD. In the OnImport2 event handler I try to assign the folder object returned to my global folder. It seems to work o.k. I can compare the properties of both objects when I am still in the OnImport2 handler and they look the same. Here is the problem. When I try to add more files to my global folder the whole app crashes! Is there a known issue with using the NeroCOM in mutisessions with VB.NET. Any help is greatly appreciated.


#2

I’ve not been able to get OnDoneImport2 to work in VB.NET although it doesn’t crash my app. In my case an error occurs if I access the OnDoneImport2 Folder parameter or any variable I set from it. I also tried an excellent example by Unison on this forum presuming it was my code that was wrong but this also will not work in VB.NET although it works fine in VB6.

Try using OnDoneImport - this works for me - you may need to restart the IDE to get OnDoneImport to work if OnDoneImport2 has already failed as something seems to be cached on my machine.


#3

Thank you very much. I will give OnImport a try. I think we were having a similar problem. I’ll post whether this helps me or not for future readers.


#4

When I used OnImport instead of OnImport2 the behavior didn’t change. Within the OnImport event do you a statement like:

globalFolder = pFolder

This causes me serious problems. I resorted to copying file by file in pFolder to globalFolder. In doing this I notice the .EntryTime property of the files is incorrect. Also the .SourceFilePath property is empty.

This COM object seems awfully buggy. I’m beginning to wonder if I should use something else.


#5

i required your help - how i will use the nehro in my application using SDk and also i will require SDK 1.05.


#6

Bottom line:

I have messed with this way longer than I should have and in summary I think that the .ImportIsoTrack() method of the drive object doesn’t work right under VB .NET. The events, OnImport and OnImport2 will fire but the pFolder object doesn’t seem to be filled out entirely. All it contains is the Names of the files and a messed up date. The path isn’t even there so when I go to burn a new image the program hangs because it can’t find the specified path.


#7

This is my OnImport code:

Public Sub m_Drive_OnDoneImport(ByRef Ok As Boolean, ByRef Folder As NEROLib.NeroFolder, ByRef CDStamp As NEROLib.NeroCDStamp) Handles m_Drive.OnDoneImport

    If Ok Then
        m_nfFolder = Folder
    Else
        MsgBox("Error Reading Data")
    End If

    m_bDriveFinished = True

End Sub

This is the line that starts the import:

m_Drive.ImportIsoTrack(nTrack, NERO_IMPORT_ISO_TRACK_FLAGS.NERO_IMPORT_ISO_ONLY)

I could be wrong but I think that SourceFilePath is only of relevance to new files added to the ISO track not ones read from the DVD.

When you say that the path isn’t there what do you mean? The imported track is a recursive tree i.e. there is a file object containing just files and a folder object which can have files and folders and so on down.


#8

I have the same code as you listed. If I try to use the global folder after I exit the OnImport event my app crashes. I see an error like “error: an exception of type: {System.InvalidCastException} occurred”.

I am doing all this from within a class. I wonder if that could be a problem. It looks like you are using a module.


#9

No, I’m using a class. Thats the error I was getting - you have rem’d out OnDoneImport2 and restarted the IDE? Also are you checking the folder variable within OnDoneImport or once its left OnDoneImport?


#10

I took out the OnImport2 event. I also shut down the IDE, even the computer and rebooted. I am saving the folder from within the OnDoneImport event. I am saving it to a folder object that is global to my class. If I look at my global copy from within the OnDoneImport event it looks ok but when I try to look or use the global copy after I have exited OnDoneImport that I get the error.

What version of Nero are you using? I have 6.3.1.20 and am using 1.05 of the SDK.


#11

I thought I would post my class definition. At this point I am only trying to burn one or more files to the CD or DVD. I don’t do anything with folders or subfolders. When I create an object of this type, I do the following:

  1. I erase the disc.
  2. Then I burn 1 file to it.
  3. I then shut down my app.
  4. I run it again and use getCDInfo to find the last session number.
  5. I then use ImportSession to get the last session.
  6. Then I use addfile to add a new file to rootfolder.

This is when I get the error. As an aside note. If I do not shut down the app then it works alright because the other file information is still in my global folder. OnImportDone really doesn’t do anything in this case. That is why I shut down the app and re-run it. This is the only case where the only way the folder information will be retrieved is with OnImportDone. Anyway, here is my class definition. Thanks for your interest DWizard100.

Imports NEROLib
Imports NEROLib.NERO_MEDIA_TYPE
Imports NEROLib.NERO_BURN_OPTIONS
Imports NEROLib.NERO_BURN_FLAGS
Imports NEROLib.NERO_BURN_ERROR
Imports NEROLib.NERO_RESPONSE
Imports NEROLib.NERO_ERASE_MODE

Public Class clsNeroBurner
Private strMessage As String
Private intProgress As Integer

Private WithEvents nero As nero
Private WithEvents drive As NeroDrive

Private drives As INeroDrives
Private rootfolder As NeroFolder
Private track As NeroISOTrack
Private stamp As NeroCDStamp
Private file As NeroFile
Private gFolder As NeroFolder

Private gSessionNumber As Integer

'*******************************************************
'******************************* PROPERTIES **************
'*******************************************************
Property Message() As String
    Get
        Return strMessage
    End Get
    Set(ByVal Value As String)
        strMessage = Value
    End Set
End Property

Property Progress() As Integer
    Get
        Return intProgress
    End Get
    Set(ByVal Value As Integer)
        intProgress = Value
    End Set
End Property

'*******************************************************
'******************************* EVENTS *****************
'*******************************************************
Public Event OnMessageUpdate()
Public Event OnProgressUpdate()

'*******************************************************
'******************************* METHODS ****************
'*******************************************************

'Constructor
Public Sub New()
    'Clear the message string
    strMessage = ""
    intProgress = 0

    'Create Nero Object
    nero = New Nero

    'Create Folder Object
    'This will contain all files to be burned
    rootfolder = New NeroFolder

    'Create Drives Oject
    drives = nero.GetDrives(NERO_MEDIA_CD + NERO_MEDIA_DVD_M)

    'Create Drive Object
    drive = drives.Item(0)
End Sub

'*******************************************************
Public Function AddFile(ByVal strFilePathName As String) As Integer
    Dim intTest As Integer

    'Create a new file object
    file = New NeroFile

    'Save files Entry Time, Name, and Path
    file.EntryTime = Now
    file.Name = NameFromPath(strFilePathName)
    file.SourceFilePath = strFilePathName

    'Add the file to our root folder
    rootfolder.Files.Add(file)

    'Destroy the file object for next time
    file = Nothing

    AddFile = 0 'Success
End Function

'*******************************************************
Public Function Burn(ByVal strName As String) As Integer
    track = New NeroISOTrack
    track.Name = strName
    track.RootFolder = rootfolder
    track.BurnOptions = NERO_BURN_OPTION_CREATE_ISO_FS + NERO_BURN_OPTION_USE_JOLIET

    drive.BurnIsoAudioCD("", _
                         "", _
                         False, _
                         track, _
                         Nothing, _
                         Nothing, _
                         NERO_BURN_FLAG_CLOSE_SESSION + NERO_BURN_FLAG_WRITE, _
                         100, _
                         NERO_MEDIA_CD + NERO_MEDIA_DVD_M)

    strMessage = "Burning process started!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Function

'*******************************************************
Public Function ImportMultisession(ByVal strName As String) As Integer
    drive.ImportIsoTrack(gSessionNumber, NERO_IMPORT_ISO_TRACK_FLAGS.NERO_IMPORT_ISO_ONLY)

    strMessage = "Importing previous session!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Function

'*******************************************************
Public Sub EraseMedia()
    drive.EraseDisc(True, NERO_ERASE_MODE_DISABLE_EJECT)

    strMessage = "Erasing Media!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

'*******************************************************
Public Sub Abort()
    nero.Abort()
End Sub

'*******************************************************
Public Sub getCDInfo()
    drive.CDInfo(NERO_CDINFO_FLAGS.NERO_READ_ISRC)

    strMessage = "Getting CD/DVD Information!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

'*******************************************************
Private Function NameFromPath(ByVal strPath As String) As String
    Dim lngPos As Long
    Dim strPart As String
    Dim blnIncludesFile As Boolean

    lngPos = InStrRev(strPath, "\")
    blnIncludesFile = InStrRev(strPath, ".") > lngPos
    strPart = ""

    If lngPos > 0 Then
        If blnIncludesFile Then
            strPart = strPath.Substring(lngPos)
        End If
    End If

    NameFromPath = strPart
End Function

'*******************************************************
'************************ NERO OBJECT EVENTS **************
'*******************************************************

Private Sub nero_OnMegaFatal() Handles nero.OnMegaFatal
    strMessage = "A fatal error has occurred!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnNonEmptyCDRW(ByRef Response As NERO_RESPONSE) Handles nero.OnNonEmptyCDRW
    strMessage = "The media is not empty!" + Chr(13) + Chr(10)
    Response = NERO_RETURN_EXIT

    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnWaitCD(ByRef WaitCD As NEROLib.NERO_WAITCD_TYPE, ByRef WaitCDLocalizedText As String) Handles nero.OnWaitCD
    strMessage = WaitCDLocalizedText + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnWaitCDDone() Handles nero.onwaitcddone
    strMessage = "Media found!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnWaitCDMediaInfo(ByRef LastDetectedMedia As NEROLib.NERO_MEDIA_TYPE, ByRef LastDetectedMediaName As String, ByRef RequestedMedia As NEROLib.NERO_MEDIA_TYPE, ByRef RequestedMediaName As String) Handles nero.OnWaitCDMediaInfo
    strMessage = "Waiting for a RequestedMediaName !" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnWaitCDReminder() Handles nero.OnWaitCDReminder
    strMessage = "Still waiting for valid media..." + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

'*******************************************************
'************************ DRIVE OBJECT EVENTS *************
'*******************************************************

Private Sub drive_OnAborted(ByRef Abort As Boolean) Handles drive.OnAborted
    Abort = False
End Sub

Private Sub drive_OnAddLogLine(ByRef TextType As NERO_TEXT_TYPE, ByRef Text As String) Handles drive.OnAddLogLine
    strMessage = Text + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnDoneBurn(ByRef StatusCode As NEROLib.NERO_BURN_ERROR) Handles drive.OnDoneBurn
    If StatusCode <> NERO_BURN_OK Then
        strMessage = "Burn finished with errors! Status Code (" & StatusCode & ")"
    Else
        strMessage = "Burn finished successfully!" + Chr(13) + Chr(10)
    End If
    track = Nothing
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnDoneCDInfo(ByVal pCDInfo As INeroCDInfo) Handles drive.OnDoneCDInfo
    gSessionNumber = pCDInfo.Tracks.Count - 1

    strMessage = "CD/DVD Information Retrieved!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnDoneErase(ByRef Ok As Boolean) Handles drive.OnDoneErase
    If Ok = True Then
        strMessage = "Disc Erase Successful!" + Chr(13) + Chr(10)
    Else
        strMessage = "Disc Erase Failed!" + Chr(13) + Chr(10)
    End If
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnDoneImport(ByRef Ok As Boolean, ByRef pFolder As NeroFolder, ByRef pCDStamp As NeroCDStamp) Handles drive.OnDoneImport
    If Ok Then
        rootfolder = pFolder
        strMessage = "Previous Session Imported!" + Chr(13) + Chr(10)
    Else
        strMessage = "Error Importing Session!" + Chr(13) + Chr(10)
    End If

    RaiseEvent OnMessageUpdate()
End Sub

'Private Sub drive_OnDoneImport2(ByVal Ok As Boolean, ByVal pFolder As NeroFolder, ByVal pCDStamp As NeroCDStamp, ByVal pImportInfo As NeroImportDataTrackInfo, ByVal importResult As NERO_IMPORT_DATA_TRACK_RESULT) Handles drive.OnDoneImport2
'    Dim i As Integer
'    Dim tempfile As NeroFile

'    If Ok Then
'        For i = 0 To (pFolder.Files.Count - 1) Step 1
'            tempfile = New NeroFile
'            tempfile.Name = pFolder.Files.Item(i).Name
'            tempfile.EntryTime = pFolder.Files.Item(i).EntryTime
'            tempfile.SourceFilePath = pFolder.Files.Item(i).SourceFilePath
'            rootfolder.Files.Add(tempfile)
'            tempfile = Nothing
'        Next i
'    End If

'    strMessage = "Previous Session Imported!" + Chr(13) + Chr(10)
'    RaiseEvent OnMessageUpdate()
'End Sub

Private Sub drive_OnDoneWaitForMedia(ByRef Success As Boolean) Handles drive.OnDoneWaitForMedia
    strMessage = "Done waiting for media!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnProgress(ByRef ProgressInPercent As Integer, ByRef Abort As Boolean) Handles drive.OnProgress
    Abort = False
    intProgress = ProgressInPercent
    RaiseEvent OnProgressUpdate()
End Sub

Private Sub drive_OnSetPhase(ByRef Text As String) Handles drive.OnSetPhase
    strMessage = Text + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

End Class


#12

Pkohne, I’ve made some minor changes to your code so that it burns DVD’s OK for me.

To call it:

   x.getCDInfo()
    x.ImportMultisession("hello")
    x.AddFile("c:	est.txt")
    x.Burn("Disk1")

The modified class (there should be comments near all the changes but I may have missed some):

Imports NEROLib
Imports NEROLib.NERO_MEDIA_TYPE
Imports NEROLib.NERO_BURN_OPTIONS
Imports NEROLib.NERO_BURN_FLAGS
Imports NEROLib.NERO_BURN_ERROR
Imports NEROLib.NERO_RESPONSE
Imports NEROLib.NERO_ERASE_MODE

Public Class clsNeroBurner
Private strMessage As String
Private intProgress As Integer

Private WithEvents nero As nero
Private WithEvents drive As NeroDrive

Private drives As INeroDrives
'Private rootfolder As NeroFolder
Private track As NeroISOTrack
Private stamp As NeroCDStamp
Private file As NeroFile
Private gFolder As NeroFolder

Private m_bDriveFinished As Boolean

Private gSessionNumber As Integer

'*******************************************************
'******************************* PROPERTIES **************
'*******************************************************
Property Message() As String
    Get
        Return strMessage
    End Get
    Set(ByVal Value As String)
        strMessage = Value
    End Set
End Property

Property Progress() As Integer
    Get
        Return intProgress
    End Get
    Set(ByVal Value As Integer)
        intProgress = Value
    End Set
End Property

'*******************************************************
'******************************* EVENTS *****************
'*******************************************************
Public Event OnMessageUpdate()
Public Event OnProgressUpdate()

'*******************************************************
'******************************* METHODS ****************
'*******************************************************

'Constructor
Public Sub New()
    'Clear the message string
    strMessage = ""
    intProgress = 0

    'Create Nero Object
    nero = New Nero

    'Create Folder Object
    'This will contain all files to be burned
    'rootfolder = New NeroFolder
    gFolder = New NeroFolder

    'Create Drives Oject
    drives = nero.GetDrives(NERO_MEDIA_DVD_M)

    'Create Drive Object
    drive = drives.Item(0)
End Sub

'*******************************************************
Public Function AddFile(ByVal strFilePathName As String) As Integer
    Dim intTest As Integer

    'Create a new file object
    file = New NeroFile

    'Save files Entry Time, Name, and Path
    file.EntryTime = Now
    file.Name = NameFromPath(strFilePathName)
    file.SourceFilePath = strFilePathName

    'Add the file to our root folder
    ' Changed to gFolder
    gFolder.Files.Add(file)

    'Destroy the file object for next time
    file = Nothing

    AddFile = 0 'Success
End Function

'*******************************************************
Public Function Burn(ByVal strName As String) As Integer
    track = New NeroISOTrack
    track.Name = strName

    ' Changed to gfolder
    track.RootFolder = gFolder
    track.BurnOptions = NERO_BURN_OPTION_CREATE_ISO_FS + NERO_BURN_OPTION_USE_JOLIET

    ' Changed write speed of 100 to 0 - I'm not sure if this makes any difference
    ' but 0 makes it burn at the maximum speed.
    drive.BurnIsoAudioCD("", _
    "", _
    False, _
    track, _
    Nothing, _
    Nothing, _
    NERO_BURN_FLAG_CLOSE_SESSION + NERO_BURN_FLAG_WRITE, _
    0, _
    NERO_MEDIA_DVD_M)

    strMessage = "Burning process started!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()

    m_bDriveFinished = False

    ' wait for event done and handled
    Do While Not m_bDriveFinished
        Application.DoEvents()
    Loop

End Function

'*******************************************************
Public Function ImportMultisession(ByVal strName As String) As Integer

    ' If there are no sessions don't try importing them
    If gSessionNumber >= 0 Then

        drive.ImportIsoTrack(gSessionNumber, NERO_IMPORT_ISO_TRACK_FLAGS.NERO_IMPORT_ISO_ONLY)

        m_bDriveFinished = False

        ' wait for event done and handled
        Do While Not m_bDriveFinished
            Application.DoEvents()
        Loop

        strMessage = "Importing previous session!" + Chr(13) + Chr(10)
        RaiseEvent OnMessageUpdate()

    End If

End Function

'*******************************************************
Public Sub EraseMedia()
    drive.EraseDisc(True, NERO_ERASE_MODE_DISABLE_EJECT)

    m_bDriveFinished = False

    ' wait for event done and handled
    Do While Not m_bDriveFinished
        Application.DoEvents()
    Loop

    strMessage = "Erasing Media!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

'*******************************************************
Public Sub Abort()
    ' Need to set flag and check in Do While Not m_bDriveFinished loops
    nero.Abort()
End Sub

'*******************************************************
Public Sub getCDInfo()
    drive.CDInfo(NERO_CDINFO_FLAGS.NERO_READ_ISRC)

    strMessage = "Getting CD/DVD Information!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()

    m_bDriveFinished = False

    ' wait for event done and handled
    Do While Not m_bDriveFinished
        Application.DoEvents()
    Loop

End Sub

'*******************************************************
Private Function NameFromPath(ByVal strPath As String) As String
    Dim lngPos As Long
    Dim strPart As String
    Dim blnIncludesFile As Boolean

    lngPos = InStrRev(strPath, "\")
    blnIncludesFile = InStrRev(strPath, ".") > lngPos
    strPart = ""

    If lngPos > 0 Then
        If blnIncludesFile Then
            strPart = strPath.Substring(lngPos)
        End If
    End If

    NameFromPath = strPart
End Function

'*******************************************************
'************************ NERO OBJECT EVENTS **************
'*******************************************************

Private Sub nero_OnMegaFatal() Handles nero.OnMegaFatal
    strMessage = "A fatal error has occurred!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnNonEmptyCDRW(ByRef Response As NERO_RESPONSE) Handles nero.OnNonEmptyCDRW
    strMessage = "The media is not empty!" + Chr(13) + Chr(10)

    ' Will never write because it will stop if data is found
    'Response = NERO_RETURN_EXIT
    Response = NERO_RETURN_CONTINUE

    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnWaitCD(ByRef WaitCD As NEROLib.NERO_WAITCD_TYPE, ByRef WaitCDLocalizedText As String) Handles nero.OnWaitCD
    strMessage = WaitCDLocalizedText + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnWaitCDDone() Handles nero.onwaitcddone
    strMessage = "Media found!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnWaitCDMediaInfo(ByRef LastDetectedMedia As NEROLib.NERO_MEDIA_TYPE, ByRef LastDetectedMediaName As String, ByRef RequestedMedia As NEROLib.NERO_MEDIA_TYPE, ByRef RequestedMediaName As String) Handles nero.OnWaitCDMediaInfo
    strMessage = "Waiting for a " + RequestedMediaName + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub nero_OnWaitCDReminder() Handles nero.OnWaitCDReminder
    strMessage = "Still waiting for valid media..." + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

'*******************************************************
'************************ DRIVE OBJECT EVENTS *************
'*******************************************************

Private Sub drive_OnAborted(ByRef Abort As Boolean) Handles drive.OnAborted
    Abort = False
End Sub

Private Sub drive_OnAddLogLine(ByRef TextType As NERO_TEXT_TYPE, ByRef Text As String) Handles drive.OnAddLogLine
    strMessage = Text + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnDoneBurn(ByRef StatusCode As NEROLib.NERO_BURN_ERROR) Handles drive.OnDoneBurn
    If StatusCode <> NERO_BURN_OK Then
        strMessage = "Burn finished with errors! Status Code (" & StatusCode & ")" & vbCrLf & " (" & nero.m_Nero.ErrorLog & ")"
    Else
        strMessage = "Burn finished successfully!" + Chr(13) + Chr(10)
    End If
    track = Nothing

    m_bDriveFinished = True

    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnDoneCDInfo(ByVal pCDInfo As INeroCDInfo) Handles drive.OnDoneCDInfo
    gSessionNumber = pCDInfo.Tracks.Count - 1

    m_bDriveFinished = True

    strMessage = "CD/DVD Information Retrieved!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnDoneErase(ByRef Ok As Boolean) Handles drive.OnDoneErase
    If Ok = True Then
        strMessage = "Disc Erase Successful!" + Chr(13) + Chr(10)
    Else
        strMessage = "Disc Erase Failed!" + Chr(13) + Chr(10)
    End If

    m_bDriveFinished = True

    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnDoneImport(ByRef Ok As Boolean, ByRef pFolder As NeroFolder, ByRef pCDStamp As NeroCDStamp) Handles drive.OnDoneImport
    If Ok Then
        ' Changed to gFolder
        gFolder = pFolder
        strMessage = "Previous Session Imported!" + Chr(13) + Chr(10)
    Else
        strMessage = "Error Importing Session!" + Chr(13) + Chr(10)
    End If

    m_bDriveFinished = True

    RaiseEvent OnMessageUpdate()
End Sub

'Private Sub drive_OnDoneImport2(ByVal Ok As Boolean, ByVal pFolder As NeroFolder, ByVal pCDStamp As NeroCDStamp, ByVal pImportInfo As NeroImportDataTrackInfo, ByVal importResult As NERO_IMPORT_DATA_TRACK_RESULT) Handles drive.OnDoneImport2
' Dim i As Integer
' Dim tempfile As NeroFile

' If Ok Then
' For i = 0 To (pFolder.Files.Count - 1) Step 1
' tempfile = New NeroFile
' tempfile.Name = pFolder.Files.Item(i).Name
' tempfile.EntryTime = pFolder.Files.Item(i).EntryTime
' tempfile.SourceFilePath = pFolder.Files.Item(i).SourceFilePath
' rootfolder.Files.Add(tempfile)
' tempfile = Nothing
' Next i
' End If

' strMessage = "Previous Session Imported!" + Chr(13) + Chr(10)
' RaiseEvent OnMessageUpdate()
'End Sub

Private Sub drive_OnDoneWaitForMedia(ByRef Success As Boolean) Handles drive.OnDoneWaitForMedia
    strMessage = "Done waiting for media!" + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

Private Sub drive_OnProgress(ByRef ProgressInPercent As Integer, ByRef Abort As Boolean) Handles drive.OnProgress
    Abort = False
    intProgress = ProgressInPercent
    RaiseEvent OnProgressUpdate()
End Sub

Private Sub drive_OnSetPhase(ByRef Text As String) Handles drive.OnSetPhase
    strMessage = Text + Chr(13) + Chr(10)
    RaiseEvent OnMessageUpdate()
End Sub

End Class

The

    Do While Not m_bDriveFinished
        Application.DoEvents()
    Loop

are to stop the app proceeding before the Import or Burn etc has been completed. If any of the changes don’t make sense let me know.


#13

I copied the class with your mods down and gave it a try. It isn’t crashing but if I try to burn a second session I get the following message:

“Waiting for a RequestedMediaName !
The disc is not empty.
The meia is not empty!”

Then I get the following over and over:

“Waiting for a RequestedMediaName !
— Accessing disc, please wait —
Media found!
Waiting for a RequestedMediaName !
The disc is not empty.
Media found!
The media is not empty!
Media found!”

I don’t know why it runs any different on my machine. Unless it’s my DVD burner. It’s a Toshiba DVD-R/RW.

Thanks Wizard. I think it’s a lost cause.


#14

DWizard100,

What version of the NeroCom.dll do you have? It should be at c:\program files\ahead
ero
erocom.dll. If you look at its properties you will see the version number. Mine is 1.3.0.1.


#15

Are you using a DVD-RW? If you are try a DVD-R (which is what I used) because I’m currently having a problem where it is doing what you are describing but with DVD+RW - DVD-R on the other hand works OK. I was going to raise it on the forum once I’d tried it with a DVD-RW just in case it was specific to my machine and/or DVD+RW and/or my code.

Its a strange error because if you check the text parameters in the OnWaitCDMediaInfo event its correctly recognising the disk as one of those expected but the RequestedMedia number was something like 12 which isn’t a real media type anyway.

My DVD writer is a Pioneer 107 and my version is 1.3 - I obviously need to download a newer version of Nero although I don’t think that it will make a difference.

It looks like there may be a couple of problems with NeroCom in .NET - OnDoneImport2 and DVD±RW media recognition if there are already sessions on there (empty disks work OK)?


#16

I am using a DVD-RW, although I had the same problem with a CD-RW. I changed the media type. I haven’t tried DVD-R or CD-R yet.