Hello alexp

hi

i need to know about the importisotrack in the nero 6.3 SDK.

How can i use this procedure kindly help me.

any help will be appriciated

thanks

chouhanrakesh
india

You should call ImportIsoTrack on a drive of interest with a track number and flags. When the operation finishes OnDoneImport and OnDoneImport2 will be fired. You can handle any of them and use the information provided as you find fit. The most common task is to import a previous track, add more files to it and then burn it back.

i tried but i could nt able to use ImportIsoTrack procedure as the event OnDoneImport or OnDoneImport2 Does’nt fire automatically .

kindly give me the code to get the information about the previous burnt data on the multisesion disc.

that code should be on VB 6.0.

thanks for the previous reply.

have a nice day
chouhanrakesh

Perhaps you could show us the relevant portions of your code and somebody would get an idea what is wrong?

Perhaps you could check the VB code in thread “drive ondoneimport never fires” - I initially had the problem you describe - but is now working ok.

Hi

i am using the same code which have been provided in the OnDoneImport not fires thread ,

i want to get the information of the cd through CdInfo event
and thus this event fires and after that the event OnDoneImport Does fires.
what steps should be taken .

thanks for the previous reply

chouhanrakesh
india

Are you using the most recent NeroCOM version?

i want to get the information of the cd through CdInfo event
and thus this event fires and after that the event OnDoneImport Does fires.
what steps should be taken .

I am not sure I understand this part… Could you please rephrase?

With reference to the code below:

The drive.cdinfo call and the associated Drive_OnDoneCDInfo event gives the number of previous tracks (NumExistingTracks)

If this is non-zero then the last track only should be imported (NOT all tracks). This is done using the line Drive.ImportIsoTrack I, NERO_IMPORT_ISO_ONLY, in the associated event Drive_OnDoneImport2 the imported data should be copied from the parameter pfolder to the folder variable to be burnt to CD, I do this with the line Set Folder = pFolder

All that remains is add the new data to the same folder and then burn the whole lot to CD

Hope this make sense and solves your problem!

Option Explicit

’ load references
Public WithEvents Nero As Nero
Public WithEvents Drive As NeroDrive

’ variable for holding number of existing sessions on disc when cd info read
Dim NumExistingTracks As Integer

'flag for checking if drive event finished
Dim DriveFinished As Boolean

’ list of available drives
Dim Drives As INeroDrives

Dim CancelPressed As Boolean

’ main folder to be burnt
Dim Folder As INeroFolder

’ main track to be burnt
Dim ISOTrack As NeroISOTrack

Private Sub AddMessage(ByVal Message As String)
lst_Messages.AddItem Message
If lst_Messages.ListCount <> 0 Then
lst_Messages.ListIndex = lst_Messages.ListCount - 1
lst_Messages.Refresh
End If
End Sub

’ function for removing extra spaces and lines from messages
Private Sub SplitText(ByVal Data As String)
Dim Temp As String
Dim I As Integer

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) &lt;&gt; Chr$(10) Then
        Temp = Temp + Mid$(Data, I, 1)
    End If
Next
If Temp &lt;&gt; "" Then
    AddMessage Trim$(Temp)
End If

End Sub

'Recursive function to build the Folders/Files to burn
Private Sub BuildFileFolderTree(ByRef nroFolderToUse As NeroFolder, ByRef 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_Eject_Click()
Set Drive = Drives(lst_AvailableDevices.ListIndex)
Drive.EjectCD
End Sub

Private Sub cmd_Exit_Click()
End
End Sub

Private Sub cmd_Load_Click()
Set Drive = Drives(lst_AvailableDevices.ListIndex)
Drive.LoadCD
End Sub

Private Sub Drive_OnDoneErase(Ok As Boolean)
DriveFinished = True
End Sub

Private Sub Form_Initialize()
Dim myIndex As Integer
Dim Major_High As Integer
Dim Major_Low As Integer
Dim Minor_High As Integer
Dim Minor_Low As Integer
Dim ValidVersion As Boolean
Dim LastError As Long

On Error GoTo Exit_Me

Set Nero = New Nero

'check version OK
ValidVersion = True
Nero.APIVersion Major_High, Major_Low, Minor_High, Minor_Low
If Major_High &lt; 6 Then
    ValidVersion = False
ElseIf Major_High = 6 And Major_Low &lt; 3 Then
    ValidVersion = False
ElseIf Major_High = 6 And Major_Low = 3 And Minor_High &lt; 1 Then
    ValidVersion = False
ElseIf Major_High = 6 And Major_Low = 3 And Minor_High = 1 And Minor_Low &lt; 6 Then
    ValidVersion = False
End If

If Not ValidVersion Then
    MsgBox "Nero Version 6.3.1.6 Or Greater Required!"
    End
End If
    
fme_Progress.Visible = False
pgs_Burn.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 as I have 2 CDs for bending machines normally would use first as only 1 or allow to select?
lst_AvailableDevices.ListIndex = Drives.Count - 2
    
Set Folder = New NeroFolder

Set Drive = Drives(lst_AvailableDevices.ListIndex)
Drive.EjectCD
Exit Sub

Exit_Me:
MsgBox Error$
End
End Sub

Private Sub cmd_Abort_Click()
Dim Response As Long

Response = MsgBox("Abort May Cause CD To Become Non-Read/Writeable! Abort Anyway?", vbYesNo + vbExclamation)
If Response = vbYes Then
    Nero.Abort
    CancelPressed = True
    AddMessage ""
    AddMessage "Abort Pressed!"
End If

End Sub

Private Sub cmd_Burn_Click()
Dim Source_Dir As String
Dim FSO As New FileSystemObject
Dim DateFolder As NeroFolder
Dim I As Integer
Dim X As Long

On Error GoTo Exit_Me:

CancelPressed = False
cmd_Abort.Enabled = True
cmd_Burn.Enabled = False
cmd_Exit.Enabled = False

fme_Progress.Visible = True
fme_Messages.Visible = True
lst_Messages.Clear
Me.Refresh

Set Drive = Drives(lst_AvailableDevices.ListIndex)

'set to be whatever folder you need to backup
Source_Dir = "C:\unison\bend"
If opt_YBC.Value Then
    Source_Dir = Source_Dir + "\ybc"
End If
If Opt_Log.Value Then
    Source_Dir = Source_Dir + "\log"
End If
If Not FSO.FolderExists(Source_Dir) Then
    MsgBox "Error - Source Folder Does Not Exist!"
    GoTo Exit_Me
End If

Set Folder = New NeroFolder

AddMessage "Waiting For CD Ready..."
'delay 10s to allow CD to spin up (need programatic soln!)
Delay (10)

'check if multisession data
AddMessage "Checking CD For Existing Data"
DriveFinished = False
Drive.CDInfo NERO_READ_ISRC
' wait for event done and handled
While Not DriveFinished
    If CancelPressed Then
        GoTo Exit_Me
    End If
    X = DoEvents()
Wend

'if existing session then import the last one
If NumExistingTracks &gt; 0 Then
    
    AddMessage "Reading Existing Data From CD"
    
    'read in the last session
    I = NumExistingTracks - 1
    DriveFinished = False
        
    Drive.ImportIsoTrack I, NERO_IMPORT_ISO_ONLY

    ' wait for event done and handled
    While Not DriveFinished
        If CancelPressed Then
            GoTo Exit_Me
        End If
        X = DoEvents()
    Wend
         
End If

Set DateFolder = New NeroFolder
Set ISOTrack = New NeroISOTrack

If opt_Bend.Value Then
    DateFolder.Name = "Bend " + Format(Now, "dd") + "-" + Format(Now, "mm") + "-" + Format(Now, "yyyy") + " - " + Format(Now, "hh") + "-" + Format(Now, "nn") + "-" + Format(Now, "ss")
End If
If opt_YBC.Value Then
    DateFolder.Name = "YBC " + Format(Now, "dd") + "-" + Format(Now, "mm") + "-" + Format(Now, "yyyy") + " - " + Format(Now, "hh") + "-" + Format(Now, "nn") + "-" + Format(Now, "ss")
End If
If Opt_Log.Value Then
    DateFolder.Name = "Log " + Format(Now, "dd") + "-" + Format(Now, "mm") + "-" + Format(Now, "yyyy") + " - " + Format(Now, "hh") + "-" + Format(Now, "nn") + "-" + Format(Now, "ss")
End If

' Add to folder tree
Folder.Folders.Add DateFolder

' recursively build folder tree
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 CancelPressed Then
    GoTo Exit_Me
End If

' burn folder (check if underrun protection available and use if it is)
DriveFinished = False
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

While Not DriveFinished
    If CancelPressed Then
        GoTo Exit_Me
    End If
    X = DoEvents()
Wend

cmd_Abort.Enabled = False
cmd_Burn.Enabled = True
cmd_Exit.Enabled = True
pgs_Burn.Value = 0
fme_Progress.Visible = False
Exit Sub

Exit_Me:

lst_Messages.AddItem Error$
lst_Messages.AddItem Nero.LastError

cmd_Abort.Enabled = False
cmd_Burn.Enabled = True
cmd_Exit.Enabled = True
pgs_Burn.Value = 0
fme_Progress.Visible = False

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)
SplitText Text
End Sub

’ event for burn complete prints results to message list
Private Sub drive_OnDoneBurn(StatusCode As NEROLib.NERO_BURN_ERROR)

SplitText Nero.ErrorLog
SplitText Nero.LastError

If StatusCode &lt;&gt; NEROLib.NERO_BURN_OK Then
    AddMessage "Burn not finished successfully: " & StatusCode
Else
    AddMessage "Burn finished successfully"
End If

DriveFinished = True

End Sub

'event for read cd info done
Private Sub Drive_OnDoneCDInfo(ByVal pCDInfo As NEROLib.INeroCDInfo)
'set number of existing sessions
On Local Error GoTo NoTracks:

NumExistingTracks = pCDInfo.Tracks.Count
'set done flag
DriveFinished = True
Exit Sub

NoTracks:
NumExistingTracks = 0
DriveFinished = True
End Sub

’ 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)
Dim I As Integer

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

End Sub

Private Sub drive_OnDoneWaitForMedia(Success As Boolean)
AddMessage “Done waiting for media.”
End Sub

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

Private Sub drive_OnSetPhase(Text As String)
SplitText Text
End Sub

Private Sub nero_OnMegaFatal()
AddMessage “A fatal error has occurred.”
End Sub

Private Sub nero_OnNonEmptyCDRW(Response As NEROLib.NERO_RESPONSE)
AddMessage “CD-RW not empty!”
Response = NERO_RETURN_EXIT
End Sub

Private Sub nero_OnRestart()
AddMessage “The system is being restarted.”
End Sub

Private Sub nero_OnWaitCD(WaitCD As NEROLib.NERO_WAITCD_TYPE, WaitCDLocalizedText As String)
SplitText WaitCDLocalizedText
End Sub

Private Sub nero_OnWaitCDDone()
AddMessage “Done waiting for CD.”
End Sub

Private Sub nero_OnWaitCDMediaInfo(LastDetectedMedia As NEROLib.NERO_MEDIA_TYPE, LastDetectedMediaName As String, RequestedMedia As NEROLib.NERO_MEDIA_TYPE, RequestedMediaName As String)
AddMessage "Waiting for a particular media type: " + RequestedMediaName
End Sub

Private Sub nero_OnWaitCDReminder()
AddMessage “Still waiting for CD…”
End Sub

Public Sub Delay(ByVal Time As Single, Optional ByVal ForceWait As Boolean = False)
Dim Start
Dim X
Dim SleepVal As Long

Start = Timer
While Start + Time &gt; Timer
    If Start &gt; Timer Then
        Start = Timer
    End If
    If Not ForceWait Then
        X = DoEvents()
    End If
Wend

End Sub

I use Nero 6.3.1.6

Public WithEvents mNero As Nero
Public WithEvents mDrive As NeroDrive

Private Sub BurnIt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BurnIt.Click


        mNero = New Nero()
        mDrives = Nero.GetDrives(NERO_MEDIA_TYPE.NERO_MEDIA_CDRW)
        mDrive = mDrives.Item(0)

mDrive.CDInfo(NERO_CDINFO_FLAGS.NERO_READ_ISRC)
==> NEVER FIRES!!!

End Sub

Private Sub mOnDoneCdInfo(ByVal pCDInfo As NEROLib.NeroCDInfo) Handles drive.OnDoneCDInfo
    
    MessageBox.Show(pCDInfo.Title())

End Sub

WHYYYYYYYYYYYYY???

I am not a VB expert but shouldn’t the line:

Private Sub mOnDoneCdInfo(ByVal pCDInfo As NEROLib.NeroCDInfo) Handles drive.OnDoneCDInfo 

…be somehow related to the mDrive variable? How does VB know which variable’s event does that particular function handle?

Why not the following?

Private Sub mDrive_OnDoneCdInfo(ByVal pCDInfo As NEROLib.NeroCDInfo)

This one doesn’t work…

Private Sub mOnDoneCdInfo(ByVal pCDInfo As NEROLib.NeroCDInfo) Handles mDrive.OnDoneCDInfo

This one neither!

Private Sub mDrive_OnDoneCdInfo(ByVal pCDInfo As NEROLib.NeroCDInfo)

:confused:

Try mDrive.CDInfo NERO_CDINFO_FLAGS.NERO_READ_ISRC

i.e without the brackets

brackets are “necessary”

Works for me without them, but when I but brackets in it doesn`t.

I have created a New solution in VS.NET 2003, cut and paste from VS.NET 2002 to new solution … AND NOW… ALL EVENT FIRES!!!

… i can’t believe it!!!
:eek: