Go Back   Club CDFreaks - Knowledge is Power > International Chat: Software related > Nero SDK Discussion Forum


Commercial message



Nero SDK Discussion Forum Discuss, CDInfo - OnDoneCDInfo at International Chat: Software related forum; Hi Please forgive me if this appears twice. I'm using VB6 (SP5), XP Pro (SP2) and I have the latest version of nero installed. What I want to do is: check for a cd / dvd in the drive check if that is empty, rewritable etc.... Using the neroFilllesCOM example -


Reply
 
Thread Tools
Old 08-11-2004   #1 (permalink)
New on Forum
 
Join Date: Apr 2004
Posts: 4
CDInfo - OnDoneCDInfo

Hi
Please forgive me if this appears twice.

I'm using VB6 (SP5), XP Pro (SP2) and I have the latest version of nero installed. What I want to do is:
check for a cd / dvd in the drive
check if that is empty, rewritable etc....

Using the neroFilllesCOM example - I call the CDInfo and check the OnDoneCDInfo. If there is a cd / dvd in the drive I can get the info however if the drive is empty / open I get an error message. Here is my code, I think this must be a common problem and I have searched the list but I cannot figure it out can anyone please help.
Thanks in advance

Code:
Private Sub Burn_Click()

Dim drives As INeroDrives
Set drives = nero.GetDrives(NERO_MEDIA_CDR)
Set drive = drives(AvailableDevices.ListIndex)

MsgBox drive.DriveLetter

Call drive.CDInfo(NERO_READ_ISRC)

's = drive.CDRWErasingTime(True) ' Not rewritable
's = drive.EraseDisc(False, NERO_ERASE_MODE_DISABLE_EJECT)
End Sub

Private Sub drive_OnDoneCDInfo(ByVal pCDInfo As NEROLib.INeroCDInfo)

' If (pCDInfo = Nothing) Then
' Error invalid use of object
' If (pCDInfo = Null) Then
' Runtime error 91; Object variable or With block variable not set

If (pCDInfo.Tracks.Count > 0) Then
MsgBox "Is Writable: " & pCDInfo.IsWriteable
MsgBox "MediaType: " & pCDInfo.MediaType
MsgBox "Tracks: " & pCDInfo.Tracks.Count
Else
MsgBox "No Tracks: CD / DVD Empty"
End If

Else
MsgBox "No CD / DVD"
End If

End Sub
PGavin is offline   Reply With Quote
Old 08-11-2004   #2 (permalink)
Nero Developer
 
Join Date: Oct 2003
Posts: 605
When there is no disc in drive, pCDInfo is Nothing. You must check for Nothing before using the variable.
alexp is offline   Reply With Quote
Old 09-11-2004   #3 (permalink)
New on Forum
 
Join Date: Apr 2004
Posts: 4
Re: CDInfo - OnDoneCDInfo

Thanks, In my code I have tried this

If (pCDInfo = Nothing) Then

and I keep getting the following error : Error invalid use of object

If (pCDInfo = Null) Then

and I get: Runtime error 91; Object variable or With block variable not set
PGavin is offline   Reply With Quote
Old 09-11-2004   #4 (permalink)
CD Freaks Member
 
Join Date: Dec 2003
Location: uk
Posts: 234
Re: CDInfo - OnDoneCDInfo

You should use

If pCDInfo Is Nothing Then
.
.
.
End If

Mike
unison is offline   Reply With Quote
Old 09-11-2004   #5 (permalink)
Nero Developer
 
Join Date: Oct 2003
Posts: 605
Actually, it should be something along the lines of:

Code:
If Not (pCDInfo Is Nothing) Then 
. 
. 
. 
End If
This might not be the exact VB syntax but the intention is to check that pCDInfo points to an object before trying to use it.

PGavin's original post seems to imply that exactly the opposite has been used.
alexp is offline   Reply With Quote
Old 10-11-2004   #6 (permalink)
CD Freaks Member
 
Join Date: Dec 2003
Location: uk
Posts: 234
Re: CDInfo - OnDoneCDInfo

In actual fact, the NOT is irrelevant as long as the if statement is used correctly. For example:

If pCDInfo Is Nothing Then
MsgBox "No Disk Inserted, Please Insert Disk Then Try Again!"
NumExistingTracks = -1
DriveFinished = True
Exit Sub
End If

' code for when disc is present
unison is offline   Reply With Quote
Old 10-11-2004   #7 (permalink)
Nero Developer
 
Join Date: Oct 2003
Posts: 605
You are right but I was replying with the original poster's code in mind. If you take a look at his first post, you will notice that the commented lines have reverse logic. That is why I insisted on NOT.
alexp is offline   Reply With Quote
Old 10-11-2004   #8 (permalink)
New on Forum
 
Join Date: Apr 2004
Posts: 4
Re: CDInfo - OnDoneCDInfo

Hi,
Thank you, (alexp and unison), very much for your help.
PGavin is offline   Reply With Quote
 
Reply


If you can't find where you are looking for, then become a member and get an answer fast! We have thousands of people online every moment of the day to help you! Click here



Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning OnDoneCDInfo dthomson Nero SDK Discussion Forum 1 26-03-2006 15:14
Msgbox causes OnDoneCDInfo to be called again and again Raffael Walther Nero SDK Discussion Forum 5 26-07-2005 15:15
OnDoneCDInfo?(NeroCom) Tors Nero SDK Discussion Forum 5 04-05-2004 01:41
NeroCom CDInfo lespaul36 Nero SDK Discussion Forum 3 08-04-2004 09:38
vb.net + NeroCOM + onDoneCdInfo tarlik Nero SDK Discussion Forum 2 25-03-2004 16:53


All times are GMT +2. The time now is 20:27.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0