NVAPIExample - Unneccessary calls to NeroGetAvailableSpeeds

vbimport

#1

Is there a reason why the method CSpeedComboBox::RefreshSpeeds() calls NeroGetAvailableSpeeds rather than just using the pnsdi->nsdiWriteSpeeds values passed to it?

The code is currently:

<code>
// Open the device…
//
NERO_DEVICEHANDLE hDevice = NeroOpenDevice (pnsdi);

if (hDevice != NULL)
{
// Get the speeds…
//
NERO_SPEED_INFOS * pSpeeds = NeroGetAvailableSpeeds (hDevice,
ACCESSTYPE_WRITE,
MEDIA_CD,
NULL);
if (pSpeeds != NULL)
{
CString sSpeed;

	// Loop through all available speeds and add them to
	// the combobox.
	// 
	for (DWORD i = 0; i &lt; pSpeeds-&gt;nsiNumSupportedSpeeds; i ++)
	{
		sSpeed.Format ("%d", pSpeeds-&gt;nsiSupportedSpeeds[i]);
		int iIndex = AddString (sSpeed);
		if (iIndex != CB_ERR)
		{
			// Set the item data to be the speed itself in X.
			// 
			SetItemData (iIndex, pSpeeds-&gt;nsiSupportedSpeeds[i]);
		}
	}

	NeroFreeMem (pSpeeds);
}

NeroCloseDevice (hDevice);

}
</code>

When it only needs to be:

<code>
CString sSpeed;

// Loop through all available speeds and add them to
// the combobox.
//
for (DWORD i = 0; i < pnsdi->nsdiWriteSpeeds.nsiNumSupportedSpeeds; i ++)
{
sSpeed.Format ("%d", pnsdi->nsdiWriteSpeeds.nsiSupportedSpeeds[i]);
int iIndex = AddString (sSpeed);
if (iIndex != CB_ERR)
{
// Set the item data to be the speed itself in X.
//
SetItemData (iIndex, pnsdi->nsdiWriteSpeeds.nsiSupportedSpeeds[i]);
}
}
</code>

Or am I missing something?


#2

It’s me being stupid.

NeroGetAvailableSpeeds() takes into account what disk is in the drive.


#3

Test Post. Sorry