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


Commercial message



Nero SDK Discussion Forum Discuss, getting error using NeroEraseDisc(...) at International Chat: Software related forum; I have the following Problem. When I try to erase a CDRW disc with using the nero API I always get error code 1 from NeroEraseDisc(...) returned. This only ahappens if i run the programm without debugging. If I debug the code (set a breakpoint on the top and step


Reply
 
Thread Tools
Old 21-08-2007   #1 (permalink)
New on Forum
 
Join Date: Aug 2007
Location: Austria
Posts: 2
getting error using NeroEraseDisc(...)

I have the following Problem. When I try to erase a CDRW disc with using the nero API I always get error code 1 from NeroEraseDisc(...) returned.

This only ahappens if i run the programm without debugging. If I debug the code (set a breakpoint on the top and step through) the erase process is successful. I have the same problem with when I write a disc.

I use Nero API v7.0.5.6

Has anyone an idea???

My code looks like this:

NERO_SCSI_DEVICE_INFO* nsdiDevice = (NERO_SCSI_DEVICE_INFO*)mcbxDevices.GetItemDataPtr(i);
ndhDeviceHandle = NeroOpenDevice(nsdiDevice);

if (!ndhDeviceHandle) {
AppendString(_T("Device could not be opened: ") + (CString)nsdiDevice->nsdiDeviceName);
}
else {
if (_tcscmp(nsdiDevice->nsdiDeviceName, _T("Image Recorder"))) {

NERO_CD_INFO *pInfo = NeroGetCDInfo (ndhDeviceHandle,0);
if (pInfo == NULL) {
AppendString (_T("ERROR: can't get CD-Info"));
NeroCloseDevice(ndhDeviceHandle);
return;
}
NeroFreeMem(pInfo);
}

NEROAPI_CDRW_ERASE_MODE mode = NEROAPI_ERASE_QUICK; // Default is quickly
int time;

if(m_eEraseMode == eModeComplete)
mode=NEROAPI_ERASE_ENTIRE;
time=NeroGetCDRWErasingTime(ndhDeviceHandle, mode);
if (time==-1)
AppendString(_T("No CD inserted"));
else if (time==-2)
AppendString(_T("This CD recorder doesn't support CDRW"));
else if (time==-3)
AppendString(_T("This media is not rewritable"));
CString strTemp;
strTemp.Format(_T("Erasing CDRW. This will take %d seconds."), time);
AppendString(strTemp);

//get media type
NERO_MEDIA_TYPE mediaType = NeroGetCurrentMediumType(ndhDeviceHandle);
//get speed info
NERO_SPEED_INFOS *speed = NeroGetAvailableSpeeds (ndhDeviceHandle, ACCESSTYPE_WRITE, mediaType, NULL);
DWORD uiSpeedInKb = 150; //150kB == 1x speed
if (speed != NULL)
uiSpeedInKb = speed->nsiSupportedSpeedsKBs[speed->nsiNumSupportedSpeeds-1]; //get maximum speed

int err = NeroEraseDisc(ndhDeviceHandle, mode, NEDF_DISABLE_EJECT /*don't eject disc*/, uiSpeedInKb );

NeroCloseDevice(ndhDeviceHandle);
NeroFreeMem(speed);
}
wagenwi is offline   Reply With Quote
Old 22-08-2007   #2 (permalink)
New on Forum
 
Join Date: Aug 2007
Location: Austria
Posts: 2
Re: getting error using NeroEraseDisc(...)

Now I now the Problem:
NeroOpenDevice(...); returns not NULL but needs some time to get ready.
So, if I insert a Sleep(5000); after NeroOpenDevice it works.

Has anybody a better solution?

Thanks wagenwi
wagenwi 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
NeroEraseDisc returns NDE_GENERIC_ERROR dietmarR Nero SDK Discussion Forum 1 21-09-2007 13:34
how to get the process information for NeroEraseDisc angelsky Nero SDK Discussion Forum 0 16-01-2007 01:05
NeroEraseDisc Problem ahatzig Nero SDK Discussion Forum 0 01-08-2005 10:27
Return of NeroEraseDisc phil1969 Nero SDK Discussion Forum 2 16-06-2004 11:44
NeroEraseDisc progress Bobby60 Nero SDK Discussion Forum 1 26-04-2004 19:43


All times are GMT +2. The time now is 08:42.


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