Check CDR or CDRW is blank

vbimport

#1

Anyone know of the procedure or method used to check if a media (CDR and CDRW) is blank?


#2

You should get a disc info and declare the disc empty if the track count is zero.


#3

I try to invoke the CD info method for my burner (device #1):

“drives(1).CDInfo (NERO_READ_CD_TEXT)”

When I try to capture the OnDoneCDIfo Event:

Private Sub drive_OnDoneCDInfo(pCDinfo As nerolib.neroCDInfo)
MsgBox “CD Info Call complete!”, vbOKOnly, “HEY!”
End Sub
Private Sub drive_OnDoneWaitForMedia(Success As Boolean)
strMessages = strMessages + “Done waiting for media.” + Chr(13) + Chr(10)
edtMessages = strMessages
End Sub

Which, like the “OnDoneWaitForMedia” event, is part of of the “NeroDrive” object. VB complains on compilings that the “Procedure declaration does not match the decription of event of the same name”. What am I missing here?


#4

I am not sure as I am not a VB expert, but have you declared a drive variable?

Public WithEvents drive As NeroDrive

Perhaps someone with more VB experience could help… It looks alright at first glance.


#5

yes.

“Public WithEvents drive As NeroDrive”

I thought it might be a typo? I just can’t see the problem.


#6

I have:
Private Sub Drive_OnDoneCDInfo(ByVal pCDInfo As NEROLib.INeroCDInfo)

You seem to be missing an I in INeroCDInfo.

Mike


#7

Why don’t you let the environment generate the proper event handler for you?


#8

ok… i’m stuck. Anyone have some VB6 working code snippet to retrieve whether or not a CD is blank?


I try to call the CDInfo as section 8.2.5 of the NeroCOM manual says "will be provided by the OnDoneCDInfo event of the NeroDrive object, when the user has called the CDInfo event:


drive(1).CDInfo (NERO_READ_CD_TEXT)

As you can see from the general section:


Public WithEvents nero As nero
Public drives As INeroDrives
Public WithEvents drive As NeroDrive
Public cnt As Integer
Public Folder As INeroFolder
Public strMessages As String

drive is of type “NeroDrive”, as it should(?) be. When I try to write an event procedure for the OnDoneCDInfo event:


Private Sub drive_OnDoneCDInfo(pCDinfo As nerolib.neroCDInfo)
   MsgBox "CD Info Call complete!", vbOKOnly, "HEY!"
End Sub

the VB compiler complains… “Procedure declaration does not match the decription of event of the same name”. I have tried calling:

drive(1).CDInfo (NERO_READ_CD_TEXT)
… no complaint.

with

Private Sub drive_OnDoneCDInfo(pCDinfo As nerolib.neroCDInfo)… fail
Private Sub drive_OnDoneCDInfo(pCDinfo As nerolib.IneroCDInfo)… fail

calling:

drives(1).CDInfo (NERO_READ_CD_TEXT)
i.e declaring CDInfo as type INeroDrives…
… no complaint.

with:

Private Sub drive_OnDoneCDInfo(pCDinfo As nerolib.neroCDInfo)… COMPILES!
Private Sub drive_OnDoneCDInfo(pCDinfo As nerolib.IneroCDInfo)… COMPILES!
… but no event is ever generated.

Any suggestions at all would be appreciated…


#9

My previous comment for you seems to have had no effect at all. Really, why not let the environment itself insert the proper handler on your behalf? If you did this, you would have gotten the following:

Private Sub drive_OnDoneCDInfo([b]ByVal[/b] pCDInfo As NEROLib.INeroCDInfo)

Please notice you are missing the ByVal keyword.


#10

alexp,

Sorry didn’t understand what you meant… don’t mean to ignore you.

As suggested, I replaced:
Private Sub drive_OnDoneCDInfo(pCDInfo As NEROLib.INeroCDInfo)

with:
Private Sub drive_OnDoneCDInfo(ByVal pCDInfo As NEROLib.INeroCDInfo)

no event generated. Guess, I’ll keep plugging. Thanks for your help.


Anyone have a VB code sample for capturing the CDInfo form the NeroCOM object?


#11

It seems to me you are doing only:

drives(1).CDInfo (NERO_READ_CD_TEXT)

…while never assigning the drive variable. It is no surprise you catch no events. Do the following:

set drive = drives(1)
drive.CDInfo(NERO_READ_CD_TEXT)

I must also say that drives(1) is a quite unsafe statement. I will this is for internal testing only…