Drive_OnDoneImport never fires

I am having two problems:

  1. After Call Drive.ImportIsoTrack(I, NERO_IMPORT_ISO_ONLY) the Drive_OnDoneImport event never occurs, if I add the NERO_IMPORT_UDF flag the event occurs bu the ok parameter is false.

  2. The burnt CD is not readable in a standard cd rom drive

Please can anyone help?

Code follows

Mike

Option Explicit
Dim NumExistingTracks As Integer
Dim DriveFinished As Boolean
Public WithEvents Nero As Nero

Public WithEvents Drive As NeroDrive

Dim Drives As INeroDrives
Dim Folder As INeroFolder
Dim isotrack As NeroISOTrack
Dim File As NeroFile

Private Sub cmd_Abort_Click()
Nero.Abort
End Sub

'Recursive function to build the Folders/Files to burn
Private Sub BuildFileFolderTree(ByRef nroFolderToUse As NeroFolder, folCurrent As Folder)
Dim folTMP As Folder
Dim filTMP As File
Dim nroFolTmp As NeroFolder
Dim nroFilTmp As NeroFile

'Add all files in the current directory
For Each filTMP In folCurrent.Files
Set nroFilTmp = New NeroFile
nroFilTmp.Name = filTMP.Name
nroFilTmp.SourceFilePath = filTMP.Path
nroFolderToUse.Files.Add nroFilTmp
Next

'Write the sub folders
For Each folTMP In folCurrent.SubFolders
Set nroFolTmp = New NeroFolder
nroFolTmp.Name = folTMP.Name
nroFolderToUse.Folders.Add nroFolTmp
Call BuildFileFolderTree(nroFolTmp, folTMP)
Next

End Sub

Private Sub cmd_Burn_Click()
Dim Source_Dir As String
Dim X As Boolean
Dim temp
Dim FSO As New FileSystemObject
Dim DateFolder As NeroFolder

Source_Dir = "C:\unison\bend\ybc"
lst_Messages.Clear

cmd_Abort.Enabled = True
cmd_Burn.Enabled = False


Set DateFolder = New NeroFolder

Set isotrack = New NeroISOTrack






DateFolder.Name = "YBC " + Format(Now, "dd") + "-" + Format(Now, "mm") + "-" + Format(Now, "yyyy") + "--" + Trim$(CInt(Rnd * 1000))
Folder.Folders.Add DateFolder
Call BuildFileFolderTree(DateFolder, FSO.GetFolder(Source_Dir))

isotrack.Name = "Unison"
isotrack.RootFolder = Folder
isotrack.BurnOptions = NERO_BURN_OPTION_CREATE_ISO_FS + NERO_BURN_OPTION_USE_JOLIET
If Drive.Capabilities And NERO_CAP_BUF_UNDERRUN_PROT Then
    Drive.BurnIsoAudioCD "Unison", "Backup", 0, isotrack, Nothing, Nothing, NERO_BURN_FLAG_WRITE + NERO_BURN_FLAG_BUF_UNDERRUN_PROT + NERO_BURN_FLAG_CLOSE_SESSION, 0, NERO_MEDIA_CD
Else
    Drive.BurnIsoAudioCD "Unison", "Backup", 0, isotrack, Nothing, Nothing, NERO_BURN_FLAG_WRITE + NERO_BURN_FLAG_CLOSE_SESSION, 0, NERO_MEDIA_CD
End If

' makes CD ok but not readable in std cdrom

End Sub

Private Sub GetInfo()
Dim X

Set Drive = Drives(lst_AvailableDevices.ListIndex)
Drive.CDInfo NERO_READ_ISRC
X = DoEvents()

End Sub

Private Sub cmd_LoadExisiting_Click()
Dim I As Integer
Dim X As Long
DriveFinished = False
Call GetInfo
While Not DriveFinished
X = DoEvents()
Wend
For I = 0 To NumExistingTracks - 1
DriveFinished = False
'gets here but done import event never fires if +NERO_IMPORT_UDF added then event fires but gives ok parameter is false
Call Drive.ImportIsoTrack(I, NERO_IMPORT_ISO_ONLY)
While Not DriveFinished
X = DoEvents()
Wend
Next
End Sub

Private Sub drive_OnAborted(Abort As Boolean)
Abort = False
End Sub

Private Sub drive_OnAddLogLine(TextType As NEROLib.NERO_TEXT_TYPE, Text As String)
If Not SplitText(Text) Then
MsgBox “Error Splitting Message Data!”
End If
End Sub

Private Function SplitText(ByVal Data As String) As Boolean
Dim temp As String
Dim I As Integer

SplitText = False

temp = ""
For I = 1 To Len(Data)
    If Mid$(Data, I, 1) = Chr$(13) Then
        lst_Messages.AddItem Trim$(temp)
        temp = ""
    ElseIf Mid$(Data, I, 1) <> Chr$(10) Then
        temp = temp + Mid$(Data, I, 1)
    End If
Next
If temp <> "" Then
    lst_Messages.AddItem Trim$(temp)
End If
If lst_Messages.ListCount <> 0 Then
    lst_Messages.ListIndex = lst_Messages.ListCount - 1
    lst_Messages.Refresh
End If
SplitText = True

End Function

Private Sub drive_OnDoneBurn(StatusCode As NEROLib.NERO_BURN_ERROR)
Dim strMessages As String

If Not SplitText(Nero.ErrorLog) Then
    MsgBox "Error Splitting Message Data!"
End If
If Not SplitText(Nero.LastError) Then
    MsgBox "Error Splitting Message Data!"
End If

strMessages = "Burn finished "
If StatusCode <> NEROLib.NERO_BURN_OK Then
    strMessages = strMessages + "NOT Successfully (" & StatusCode & ")"
Else
    strMessages = strMessages + "Successfully"
End If

lst_Messages.AddItem strMessages
If lst_Messages.ListCount <> 0 Then
    lst_Messages.ListIndex = lst_Messages.ListCount - 1
    lst_Messages.Refresh
End If
cmd_Abort.Enabled = False

cmd_Burn.Enabled = True
pgs_progress1.Value = 0

End Sub

Private Sub Drive_OnDoneCDInfo(ByVal pCDInfo As NEROLib.INeroCDInfo)

NumExistingTracks = pCDInfo.Tracks.Count
DriveFinished = True

End Sub

Private Sub Drive_OnDoneImport(Ok As Boolean, inFolder As NEROLib.INeroFolder, CDStamp As NEROLib.INeroCDStamp)

If Ok Then
    Folder.Folders.Add inFolder
Else
    MsgBox "Error Reading In Data"
End If
DriveFinished = True

End Sub

'Private Sub Drive_OnDoneImport2(ByVal bOk As Boolean, ByVal pFolder As NEROLib.INeroFolder, ByVal pCDStamp As NEROLib.INeroCDStamp, ByVal pImportInfo As NEROLib.INeroImportDataTrackInfo, ByVal importResult As NEROLib.NERO_IMPORT_DATA_TRACK_RESULT)
’ If bOk Then
’ Folder.Folders.Add pFolder
’ Else
’ MsgBox “Error Reading In Data”
’ End If
’ DriveFinished = True
'End Sub

Private Sub drive_OnDoneWaitForMedia(Success As Boolean)
lst_Messages.AddItem “Done waiting for media.”
If lst_Messages.ListCount <> 0 Then
lst_Messages.ListIndex = lst_Messages.ListCount - 1
lst_Messages.Refresh
End If
End Sub

Private Sub drive_OnProgress(ProgressInPercent As Long, Abort As Boolean)
Abort = False
pgs_progress1.Value = ProgressInPercent
End Sub

Private Sub drive_OnSetPhase(Text As String)
If Not SplitText(Text) Then
MsgBox “Error Splitting Message Data!”
End If
End Sub

Private Sub Form_Initialize()
Dim myIndex As Integer
Set Nero = New Nero

pgs_progress1.Value = 0
lst_Messages.Clear

Set Drives = Nero.GetDrives(NERO_MEDIA_CDR + NERO_MEDIA_CDRW)

For myIndex = 0 To Drives.Count - 1
    lst_AvailableDevices.AddItem Drives(myIndex).DeviceName, myIndex
Next
'set to second item (normally would use first or allow to select?)
lst_AvailableDevices.ListIndex = 1

Set Drive = Drives(lst_AvailableDevices.ListIndex)
Set Folder = New NeroFolder

ErrHandler:
Exit Sub
End Sub

Private Sub nero_OnMegaFatal()
lst_Messages.AddItem “A mega fatal error has occurred.”
If lst_Messages.ListCount <> 0 Then
lst_Messages.ListIndex = lst_Messages.ListCount - 1
lst_Messages.Refresh
End If
End Sub

Private Sub nero_OnNonEmptyCDRW(Response As NEROLib.NERO_RESPONSE)
lst_Messages.AddItem “CD-RW not empty!”
If lst_Messages.ListCount <> 0 Then
lst_Messages.ListIndex = lst_Messages.ListCount - 1
lst_Messages.Refresh
End If
Response = NERO_RETURN_EXIT
End Sub

Private Sub nero_OnRestart()
lst_Messages.AddItem “The system is being restarted.”
If lst_Messages.ListCount <> 0 Then
lst_Messages.ListIndex = lst_Messages.ListCount - 1
lst_Messages.Refresh
End If
End Sub

Private Sub nero_OnWaitCD(WaitCD As NEROLib.NERO_WAITCD_TYPE, WaitCDLocalizedText As String)
If Not SplitText(WaitCDLocalizedText) Then
MsgBox “Error Splitting Message Data!”
End If
End Sub

Private Sub nero_OnWaitCDDone()
lst_Messages.AddItem “Done waiting for CD.”
If lst_Messages.ListCount <> 0 Then
lst_Messages.ListIndex = lst_Messages.ListCount - 1
lst_Messages.Refresh
End If
End Sub

Private Sub nero_OnWaitCDMediaInfo(LastDetectedMedia As NEROLib.NERO_MEDIA_TYPE, LastDetectedMediaName As String, RequestedMedia As NEROLib.NERO_MEDIA_TYPE, RequestedMediaName As String)
lst_Messages.AddItem “Waiting for a particular media type:”
If Not SplitText(RequestedMediaName) Then
MsgBox “Error Splitting Message Data!”
End If
End Sub

Private Sub nero_OnWaitCDReminder()
lst_Messages.AddItem “Still waiting for CD…”
If lst_Messages.ListCount <> 0 Then
lst_Messages.ListIndex = lst_Messages.ListCount - 1
lst_Messages.Refresh
End If
End Sub

anyone?

Ok - got ondoneimport event to fire, for some reason replacing
call Drive.ImportIsoTrack (I, NERO_IMPORT_ISO_ONLY)
with just Drive.ImportIsoTrack I, NERO_IMPORT_ISO_ONLY
cured that problem.

However how do I actually add the imported data to the CD to be burnt?

If I add pfolder returned by ondoneimport2 then if I add that to the main nero folder used in cmd_burn_click (it is in scope throughout the form) then when I come to actually burn the CD the command crashes VB.

One of the messages on this forum mentions adding it as another iso track but I don`t understand how to burn several tracks onto 1 CD - how do I specify several tracks when calling BurnIsoAudioCD?

Also still need to solve the problem of reading in a standard CD rom drive?

Mike

Help… please?

After you receive the imported folder in the OnDoneImport2 event, you should create a NeroISOTrack and add the imported folder contents to the RootFolder. You should also add to it whatever new files/folders you want to burn and then you are ready to call BurnIsoAudioCD.

This is what I have tried to do but when I call burnisoaudiocd it crashes VB. I think this is because pfolder is local to the onimport done event so is destroyed by the time it comes back to the click event and tries to do a burn.
If i try to copy pfolder to something in scope of the form e.g. importfolder = pfolder I get an error that the object does not support this property or event. If i do a folder.add then this also crashes vb at the time of writing as it again no longer exists at burn time.

So what am I supposed to do?

Mike

relevant bits of code:

’ in scope throughout form
Dim ImportTrack As NeroISOTrack

’ called in click event
For I = 0 To NumExistingTracks - 1
Set ImportFolder = New NeroFolder
Set ImportTrack = New NeroISOTrack
DriveFinished = False
ImportTrack.RootFolder = ImportFolder
'gets here but done import event never fires if +NERO_IMPORT_UDF added then event fires but gives ok parameter is false
Drive.ImportIsoTrack I, NERO_IMPORT_ISO_ONLY
While Not DriveFinished
X = DoEvents()
Wend

    ImportTrack.Name = "Unison"
    
    ImportTrack.BurnOptions = NERO_BURN_OPTION_CREATE_ISO_FS + NERO_BURN_OPTION_USE_JOLIET
    If Drive.Capabilities And NERO_CAP_BUF_UNDERRUN_PROT Then
        Drive.BurnIsoAudioCD "Unison", "Backup", 0, ImportTrack, Nothing, Nothing, NERO_BURN_FLAG_WRITE + NERO_BURN_FLAG_BUF_UNDERRUN_PROT + NERO_BURN_FLAG_CLOSE_SESSION + NERO_BURN_FLAG_DISABLE_EJECT, 0, NERO_MEDIA_CD
    Else
        Drive.BurnIsoAudioCD "Unison", "Backup", 0, ImportTrack, Nothing, Nothing, NERO_BURN_FLAG_WRITE + NERO_BURN_FLAG_CLOSE_SESSION + NERO_BURN_FLAG_DISABLE_EJECT, 0, NERO_MEDIA_CD
    End If
Next

Private Sub Drive_OnDoneImport2(ByVal bOk As Boolean, ByVal pFolder As NEROLib.INeroFolder, ByVal pCDStamp As NEROLib.INeroCDStamp, ByVal pImportInfo As NEROLib.INeroImportDataTrackInfo, ByVal importResult As NEROLib.NERO_IMPORT_DATA_TRACK_RESULT)
If bOk Then
ImportTrack.RootFolder = pFolder
Else
MsgBox “Error Reading In Data”
End If
DriveFinished = True
End Sub

This is what I have tried to do but when I call burnisoaudiocd it crashes VB. I think this is because pfolder is local to the onimport done event so is destroyed by the time it comes back to the click event and tries to do a burn.
pfolder is local but if you store it in a global variable, it won’t be destroyed.

In addition, there is no need for adding a new folder to RootFolder as in

ImportTrack.RootFolder = ImportFolder

RootFolder already contains an empty placeholder folder.

I can’t see anything wrong with the code except for the for next loop which doesn’t make much sense. What is the purpose of importing and burning each and every session?

What NeroCOM version are you using?

How do I store in a global variable - if a declare a global nerofolder then
global_folder = pfolder causes an error - object does not support this property

If it`s not usual to imprt every session what is the normal behaviour - just the last session? In that case what is the point of returning number of sessions and ways of accessing them - why not just give access to the last session?

How do I store in a global variable - if a declare a global nerofolder then
global_folder = pfolder causes an error - object does not support this property

Well I am not a VB expert but I just do a Set global_folder = pFolder. Perhaps a “set” makes a difference?

If it`s not usual to imprt every session what is the normal behaviour - just the last session? In that case what is the point of returning number of sessions and ways of accessing them - why not just give access to the last session?
No, you misunderstood my point. Of course it is normal to import any session you like, but in your code (if I am reading it correctly) you import session 0, then burn it, then import session 1, then burn it, and so on… I was only asking what was the point of that particular piece of code.

Ok with set then I am able to copy pfolder, but vb still crashes at the burn command.

Ref the for loop all I want to do is ensure all data currently accessable on the cd is still accessable I initially thought this meant loading every session but now I guess it is just the last session?

So code is now:

inside click event:
If NumExistingTracks > 0 Then

’ number of existing tracks returned by pCDInfo.Tracks.Count in onCDInfo event
I = NumExistingTracks - 1

Set ImportFolder = New NeroFolder
Set ImportTrack = New NeroISOTrack

'read in the last session
DriveFinished = False
Drive.ImportIsoTrack I, NERO_IMPORT_ISO_ONLY
’ wait for event done and handled
While Not DriveFinished
x = DoEvents()
Wend

ImportTrack.Name = “Unison”

'tried ImportTrack.RootFolder = ImportFolder
'either way vb crashes when come to burn below
ImportTrack.RootFolder.Folders.Add ImportFolder
ImportTrack.BurnOptions = NERO_BURN_OPTION_CREATE_ISO_FS + NERO_BURN_OPTION_USE_JOLIET

'burn last session (check if underrun protection available and use if it is)
If Drive.Capabilities And NERO_CAP_BUF_UNDERRUN_PROT Then
Drive.BurnIsoAudioCD “Unison”, “Backup”, 0, ImportTrack, Nothing, Nothing, NERO_BURN_FLAG_WRITE + NERO_BURN_FLAG_BUF_UNDERRUN_PROT + NERO_BURN_FLAG_CLOSE_SESSION + NERO_BURN_FLAG_DISABLE_EJECT, 0, NERO_MEDIA_CD
Else
Drive.BurnIsoAudioCD “Unison”, “Backup”, 0, ImportTrack, Nothing, Nothing, NERO_BURN_FLAG_WRITE + NERO_BURN_FLAG_CLOSE_SESSION + NERO_BURN_FLAG_DISABLE_EJECT, 0, NERO_MEDIA_CD
End If
End If

doneimport event:

’ importing of data done event
Private Sub Drive_OnDoneImport2(ByVal bOk As Boolean, ByVal pFolder As NEROLib.INeroFolder, ByVal pCDStamp As NEROLib.INeroCDStamp, ByVal pImportInfo As NEROLib.INeroImportDataTrackInfo, ByVal importResult As NEROLib.NERO_IMPORT_DATA_TRACK_RESULT)

If bOk Then
    Set ImportFolder = pFolder
Else
    MsgBox "Error Reading In Data"
End If
' set done flag
DriveFinished = True

End Sub

Which NeroCOM version are you using?

6.3.0.2

I have tested your code and it seems that a similar issue has already been reported and fixed. You will have to wait for the next NeroCOM release.

In the meantime, I will post a workaround if I find one.

Hi, any news? When will update be posted?

Mike

I’ve downloaded the newest Nero 6303 and updated my version. But my appication is still crashing when I try to burn the multisession after importing the previous session’s track.
I checked the date and the version of the NeroCOM.dll file and it doesn’t look like they have changed since the last release.
Thanks,
Craig

Have just downloaded latest update (6.3.0.3) and the drive_ondoneimport event still never occurs.

Mike

Sorry meant to say drive_ondoneimport2 event never occurs. The drive_ondoneimport event occurs but vb crashes still when I come to burn the imported data

Ok, both events do fire (was confused by some mods I had done in meantime), but either way when I come to burn the imported track VB crashes. Basically not any further on than before the latest update.

Was this problem supposed to have been fixed by this update or not?

Mike

Was this problem supposed to have been fixed by this update or not?

No, sorry. Nero 6.3.0.3 does not contain the updated NeroCOM.dll. I am afraid you will have to wait for Nero >= 6.3.0.5.

Any news about when update will be released? Boss is getting on my back!

Mike