User Dialog Callback not called

vbimport

#1

Hello… I hope somebody can help out.

My customer needs to burn DVD disks from MPEG2 files that will play in a household DVD player. I tested this functionality using the sample provided for the NeroVisionAPI and it works perfectly for what we need.

I need to provide this functionality for Visual Basic so, taking the NeroVisionAPI sample as a guide, I started writing an ATL COM dll that would take all required information from Visual Basic and burn the DVD.

So far I am able to add videos, get a list of recording devices and assign the recording device I want to use to burn the DVD.

The problem I am having is that my User Dialog Callback function is not being called by the Nero API. I make a call to NeroBur() and, through DLL events, I get progress reports on transcoding. When the NeroAPI reports to me that it is generating, it gets up to 80%.
I get reports form the NeroIdleCall back several times, and then a LogLine report that says “User Abort”. I call some messaging events from my Nero User Callback to see where it is failing or if it is entering the callback function at all, but these events are not being raised.

Here is how I am setting things up:

–My user call back function is declared as follows:
static NeroUserDlgInOut NERO_CALLBACK_ATTR NeroDialogCallback(void *pUserData, NeroUserDlgInOut type, void *data);

–and it is defined like this:

NeroUserDlgInOut NERO_CALLBACK_ATTR CDVDProject::NeroDialogCallback(void *pUserData, NeroUserDlgInOut type, void *data)
{
CDVDProject * pThis = (CDVDProject *) pUserData;
CStdString msg(“Nero Dialog is being Called!”);
pThis->DVDMessage(msg.AllocSysString());
switch (type)
{

[INDENT]case DLG_AUTO_INSERT:
{
CStdString msg(“DLG_AUTO_INSERT”);
pThis->DVDMessage(msg.AllocSysString());
return DLG_RETURN_CONTINUE;
}
case DLG_DISCONNECT_RESTART:
{
CStdString msg(“DLG_DISCONNECT_RESTART”);
pThis->DVDMessage(msg.AllocSysString());
return DLG_RETURN_ON_RESTART;
}
… more case statments go here
case DLG_WAITCD_DONE:
{
CStdString msg(“DLG_WAITCD_DONE”);
pThis->DVDMessage(msg.AllocSysString());
return DLG_RETURN_EXIT;
}
case DLG_FILESEL_IMAGE:
{
CStdString msg(“DLG_FILESEL_IMAGE”);
pThis->DVDMessage(msg.AllocSysString());
return DLG_RETURN_CONTINUE;
}
}
return DLG_RETURN_EXIT;[/INDENT]
}

–I am setting up the NEO_SETTINGS structure like this:

NERO_SETTINGS CDVDProject::ns =
{
NULL,
“Ahead”,
“Nero Burning ROM”,
“Nero.txt”,
{NeroIdleCallback, 0},
{NeroDialogCallback, 0},
FALSE,
0};

–and when I am about to initialize the NeroAPI I do this:

ns.nstIdle.ncUserData = this;
ns.nstUserDialog.ncUserData = this;

BOOL bSuccess = NeroAPIGlueConnect (NULL);
if (!bSuccess)
{
return Error(L"Cannot open NeroAPI.dll!");
}

NEROAPI_INIT_ERROR err = NeroInit (&ns, NULL);
if (err != NEROAPI_INIT_OK)
{
return Error(L"Fail to initialize NeroAPI.dll!");
}

–This is what I do to burn the DVD:

//Build project configuration XML info
IXMLDOMDocumentPtr pDocument = BuildXML ();
if (pDocument != NULL)
{
USES_CONVERSION;
try
{
[INDENT]// Create an instance of NeroVisionAPI’s Project object
EVAL_HR (m_pProject.CreateInstance (__uuidof (Project)));
INeroBurnContextPtr pBurnContext;
BOOL blnSuccess =
m_pProject->SetXMLString((LPSTR)(LPCSTR)W2CA(pDocument->xml));
if (blnSuccess)
{
VARIANT_BOOL bSuccess = m_pProject->CreateNeroBurnContext(
NeroAPIGlueGetModuleHandle (), this, &pBurnContext);
if (bSuccess)
{
// Ok, now do the burning…
LPCOLESTR errMsg;
NEROAPI_BURN_ERROR err;
// Open the device…
NERO_DEVICEHANDLE hDevice = NeroOpenDevice (GetSelectedRecorder());
if (hDevice != NULL)
{
[INDENT]NERO_PROGRESS * pNeroProgress;
// Create NERO_PROGRESS structure using API.
pNeroProgress = NeroCreateProgress ();
if (pNeroProgress != NULL)
{
// Fill-in the NERO_PROGRESS structure wiht our own callbacks.
pNeroProgress->npAbortedCallback = NeroAbortedCallback;
Progress->npAddLogLineCallback = NeroAddLogLineCallback;
pNeroProgress->npProgressCallback = NeroProgressCallback;
pNeroProgress->npUserData = this;
// Now, finally start burning using the NERO_CD_FORMAT
// and NERO_WRITE_CD as returned from NeroVisionAPI.
//Set it to Maximum speed
m_dwBurnSpeed = 0;
err = NeroBurn ([INDENT]
hDevice,
NERO_CD_FORMAT) pBurnContext->NERO_CD_FORMAT,
pBurnContext->NERO_WRITE_CD,
NBF_WRITE|NBF_DAO,
m_dwBurnSpeed, pNeroProgress;)
bBurnError = err != NEROAPI_BURN_OK;
NeroFreeMem (pNeroProgress);[/INDENT]
}
NeroCloseDevice (hDevice);
if (bBurnError)
{
switch (err)
{
[INDENT] case NEROAPI_BURN_UNKNOWN_CD_FORMAT:
return Error(L"Unknown CD Format");
case NEROAPI_BURN_INVALID_DRIVE:
return Error(L"Invalid Drive");
case NEROAPI_BURN_FAILED:
return Error(L"Burn Failed");
case NEROAPI_BURN_FUNCTION_NOT_ALLOWED:
return Error(L"Burn Function Not Allowed");
case NEROAPI_BURN_DRIVE_NOT_ALLOWED:
return Error(L"Drive Not Allowed");
case NEROAPI_BURN_USER_ABORT:
return Error(L"User Abort");
case NEROAPI_BURN_BAD_MESSAGE_FILE :
return Error(L"Bad Message File");[/INDENT]
}[/INDENT]
}[/INDENT]}

As I said…all other callback function are being called, except the User Dialog call back function.

Can anybody give me a hand with this?

Thanks, thanks, thanks!


#2

There is a number of reasons why the burn process might abort. Some callbacks such as progress, aborted and idle callback return a BOOL value which tells NeroAPI if it should abort. You should check your return values for those callbacks. Additionally, if your userdialog callback is never called, you may check the error log or last error to see if this sheds any light on the issue.

You say you get reports of transconding after calling NeroBurn() with idle callback being called several times. Are you sure transcoding happens during NeroBurn(), not before during CreateNeroBurnContext()?


#3

Hi Alex…
First of all…thanks a lot for your prompt reply.

I put some code to raise an event before calling the NeroBurn() method.
I just ran the program and you are absolutely right…the transcoding happens before the call to the NeroBurn() method.
Any ideas what could be causing the method to fail? I was carefull to be as close as possible to the NeroVisionAPI sample.
I will follow your advice and check the return values for the callbacks that are being called.

Jorge


#4

ALEX!!!
You were absolutely right!!!
The problem was exactly the values being returned by the other callbacks.

Thansk a million man…Had been messing with this for a couple of days.
Now…life is good again! :wink:

Jorge


#5

I am also glad it was that simple :slight_smile:


#6

What Version of nero are you runing and what version of the sdk?
I have problems running the sample applications they keep failing when you ask to get the transcoding estamating time.


#7

I keep getting errors when running the sample applications.
Error code: 9,XMLID:,Error text: CNeroConvertManager::CreateConverter(): unknown application (21). It looks like the error is return when you try to get estamated transcoding time. I am using the latest nero 7.7.5.1 and the 1.08sdk