How to Notify my application?

vbimport

#1

Hi,

how can i notify my application from the static NeroSDK callbacks:
IdleCallback();
ProgressCallback();

example:

BOOL NERO_CALLBACK_ATTR ServiceNeroBurning::ProgressCallback(void *pUserData, DWORD dwProgressInPercent)
{
// here i get the error= “illegal call of non-static member function”
OnProgress(dwProgressInPercent);
return true;
}

thanks zik


#2

You cannot call a non-static member function from within a static function, as the ProgressCallback function is.

I send a message to the window that updates the progress bar with the dwProgressInPercent passed to it.

I store a pointer to this window in a static variable m_pWndOwner in the class constructor.

In my class header file I have:

static CWnd* m_pWndOwner;

And in the .cpp file:

CWnd* CNeroInterface::m_pWndOwner = NULL; // initialise variable

//Class constructor

CNeroInterface::CNeroInterface(CWnd* pOwner)
{
m_pWndOwner = pOwner; // m_pWndOwner now points to the window
// that handles the progress messages
}

// Progress Callback function

BOOL NERO_CALLBACK_ATTR CNeroInterface::ProgressCallback(void* pUserData,
DWORD dwProgressInPercent)
{
if(NULL != m_pWndOwner)
m_pWndOwner->SendMessageToDescendants(WM_PROGRESS,
(WPARAM)dwProgressInPercent, (LPARAM)0);

return(m_bAborted);

}

The class that handles the WM_PROGRESS message will recieve the progress bar value as its first parameter.

Hope this helps.


#3

Thanks that were helpful.

I have another q do you have some code example of a function that’s get a directory path string something like:

MapFiles(CString sDirPath)

And recursively maps all the files to the NeroSDK.

Like the Nero express do with add file/dir for burning…

Thanks zik


#4

Hi. I have answered your question in the correct thread.