How to find Inserted Media is CD-R or CD-RW

hi,

Please help me to find whether the inserted media/disc is CD-R or CD-RW using nero SDK.

regards,
raji

NeroGetCDInfo(…) returns pointer of NERO_CD_INFO structure

the member ncdiMediaType contains the mediatype

use MEDIA_CDR and MEDIA_CDRW for test again ncdiMediaType
example:
if (pCDInfo->ncdiMediaType & MEDIA_CDR) == MEDIA_CDR) --> CDR found

thanks for ur reply.
but how to use NeroGetCDInfo(…) function in VisualBasic which returns pointer of NERO_CD_INFO structure.

NeroCOM provides the same functionality as the C-Style interface of NeroAPI and can be access via VisualBasic. This COM interface to NeroAPI is also a part of NeroSDK.

can one help to use java to write CD/DVD?

I don’t know if this helps, but here is a C# class I threw together. Please note, Nero requires using events for synchronization, I did finish this code yet. I did not try a cdrw so maybe there is an issue with that? I’m only using cd-r and dvd-r.

using System;
using System.Collections.Generic;
using System.Text;
using NEROLib;
using System.Threading;
namespace ManageDvd
{
publicstructScanInfo
{
publicstring driveLetter;
publicstring driveMedia;
}
publicclassScanDrivesEventArgs : EventArgs
{
List<ScanInfo> m_info;
public ScanDrivesEventArgs(List<ScanInfo> info)
{
m_info = info;
}
publicList<ScanInfo> Info
{
get { return m_info; }
}
}
classScanDrives
{
publiceventEventHandler<ScanDrivesEventArgs> ScanMediaNotifyComplete;
// Nero Setup
private Nero m_nero = null;
private NeroDrives m_drives = null;
private NERO_MEDIA_TYPE[] m_mediaThreadSafe = null;
privateconst NERO_MEDIA_TYPE m_acceptedMedia = NERO_MEDIA_TYPE.NERO_MEDIA_CDR | NERO_MEDIA_TYPE.NERO_MEDIA_DVD_M_R;
public ScanDrives()
{
m_nero = new Nero();
m_nero.OnWaitCDMediaInfo += new _INeroEvents_OnWaitCDMediaInfoEventHandler(m_nero_OnWaitCDMediaInfo);
}
publicvoid ScanDrivesForMedia()
{
Thread t = newThread(Scan);
t.Start();
}
privatevoid Scan()
{
m_nero.Abort();
// TODO: wait for abort event
Thread.Sleep(250); // needs to be at least 100mS
m_nero.ClearErrors();
m_drives = m_nero.GetDrives(m_acceptedMedia);
List<ScanInfo> m_mediaList = newList<ScanInfo>();
m_mediaThreadSafe = new NERO_MEDIA_TYPE[1];
foreach (INeroDrive drive in m_drives)
{
if (drive.HostAdapterNo < 0)
{
// skip, these are not burners
continue;
}
lock (m_mediaThreadSafe)
{
// m_mediaThreadSafe is updated in the callback
m_mediaThreadSafe[0] = m_acceptedMedia;
}
try
{
NeroCDStamp m_ncds = null; // make Nero happy
drive.WaitForMedia(NERO_MEDIA_TYPE.NERO_MEDIA_NONE, NERO_BURN_FLAGS.NERO_BURN_FLAG_SIMULATE, m_ncds);
}
catch
{
m_nero.Abort();
Thread.Sleep(250); // TODO: wait for abort event
m_nero.ClearErrors();
continue;
}
NERO_MEDIA_TYPE pollSafeForMedia;
int timeout = 5000;
int mS = 10;
do
{
Thread.Sleep(mS);
timeout -= mS;
lock (m_mediaThreadSafe)
{
pollSafeForMedia = m_mediaThreadSafe[0];
}
if (timeout < 0)
{
pollSafeForMedia = NERO_MEDIA_TYPE.NERO_MEDIA_NONE;
}
} while (pollSafeForMedia == m_acceptedMedia);
if (pollSafeForMedia == NERO_MEDIA_TYPE.NERO_MEDIA_CDR)
{
ScanInfo media = newScanInfo();
media.driveLetter = drive.DriveLetter.ToUpper() + “:”;
media.driveMedia = “CD-R”;
m_mediaList.Add(media);
}
elseif (pollSafeForMedia == NERO_MEDIA_TYPE.NERO_MEDIA_DVD_M_R)
{
ScanInfo media = newScanInfo();
media.driveLetter = drive.DriveLetter.ToUpper() + “:”;
media.driveMedia = “DVD-R”;
m_mediaList.Add(media);
}
else
{
m_nero.Abort();
Thread.Sleep(250); // TODO: wait for abort event
m_nero.ClearErrors();
}
}
EventHandler<ScanDrivesEventArgs> notify = ScanMediaNotifyComplete;
if (notify != null)
{
ScanDrivesEventArgs e = newScanDrivesEventArgs(m_mediaList);
notify(this, e);
}
}
privatevoid m_nero_OnWaitCDMediaInfo(ref NERO_MEDIA_TYPE LastDetectedMedia, refstring LastDetectedMediaName, ref NERO_MEDIA_TYPE RequestedMedia, refstring RequestedMediaName)
{
//Console.WriteLine(LastDetectedMedia.ToString() + " || " + LastDetectedMediaName + " || " + RequestedMedia.ToString() + " || " + RequestedMediaName);
lock (m_mediaThreadSafe)
{
m_mediaThreadSafe[0] = LastDetectedMedia;
}
}
}
}