Burning directories with NeroAPI


I try to burn a directory (incl. content and subdirectories) using NeroAPI. I used the sample NeroFiddles, but I could’nt do that.
The OnBrowse-function in the NeroFiddles can select files (not directories). I wrote a funtion to select the directories, but the OnBurn-function does’nt work with the returned value.

can somebody help me?


have a look at my post (directly under yours) with the title
Multisession, Folder-Creation with NeroAPI.

For each file and folder, you’ve to create a NERO_ISO_ITEM with a pointer to the next NERO_ISO_ITEM (nextItem, or firstSubDirectoryItem).
That means

file one’s Item-Struct points to the struct of file two,
the struct of file two points to the struct of file three and so on.

If there are more questions, post again.

Hi TimS,

thank you for this solution. But I want to select the directory and not the files. Would this work with your second solution (isDirectory=true) ?

Hi zavoshi,

you have to create an Iso-Item for each Directory and for each file (even those in the directories).

If you have the directory-struct like

and you want to burn the content of folder
Burn, the first IsoItem has to be filled with

->fileName= “FolderA” (use strcpy)
->sourceFilePath= “” (use strcpy)
->isDirectory= TRUE
->subDirFirstItem= (Pointer to IsoItem struct of ‘File1’)
->nextItem= (Pointer to IsoItem-struct of ‘FolderB’)

->fileName= “File1” (use strcpy)
->sourceFilePath= “c:\Burn\FolderA\File1” (use strcpy)
->isDirectory= FALSE
->subDirFirstItem= NULL
->nextItem= (Pointer to IsoItem of File2)

->fileName= “File4” (use strcpy)
->sourceFilePath= “c:\Burn\File4” (use strcpy)
->isDirectory= FALSE
->nextItem= NULL
->subDirFirstItem= NULL

create each IsoItem like this;

pItem= NeroCreateIsoItem();

pass the first IsoItem (FolderA) to the NeroCreateIsoTrackEx-Function

after burning, free the memory with


(pass the first item to this function)

I hope this helps,

Hi TimS,

thanks a lot. you are a great help. But I want to burn a directory and I don’t know the content. User must select the directory and the application shall burn the content on a CD. Do you understand my problem. I don’t Know the subdirectories and their content.



Hello zavoshi,

I think, you’ve to find out, which files are in the selected directory, maybe like this:

CFileFind cffFile;
cffFile.FindFile("c:\	est\\*.*");
      CString cstrFile;
      cstrFile= cffFile.GetFilePath();

      // and now put this file into the list
      // for your NeroIsoItems

but attention, you have to call FindNextFile one time before calling GetFilePath() (according to ms-help),
I think there are some more difficults.
If you, or somebody else here, knows a better way, please post it.

thank you, and have a nice weekend,

Hello zavoshi,

could you tell me, how you create a file-selection-dialog, where the user can select a directory, and not a file.

Thank you,

Hi TimS,

enter this Code to the OnBrowse() Function an so can you select a directory:


static char BASED_CODE szFilter[] = “All Files (.)|.”;

BROWSEINFO bi = {0};
TCHAR path[255];

LPITEMIDLIST pidl=SHBrowseForFolder(&bi);
if (pidl !=0 )
if (SHGetPathFromIDList(pidl,path))
mstrPathName = path;

	 if (pndiDeviceInfos->nsdisNumDevInfos > 0)




Have a nice weekend.

Hi TimS,

I couldn’t burn the CD with your solution. Maybe I can’t use it.
Did you use the code to select zhe directory?
could you burn a directory using this method?



Hello Zavoshi,

I didn’t try your directory-selection, because in my running project, there’s no need for it. I asked you, because I’ll maybe need it at another corner.

I’ve got a list with all files to burn.

You can use this function, to find out all files in a given directory:

// puts all files in the given directory (strPfad) into the filelist of m_Burn
void CreateFilelist(string strPfad)
	char* pszTemp;
	pszTemp= new char [512 +1];
	strnset(pszTemp, '\0', 512);
	sprintf(pszTemp, "%s\\*.*", strPfad.c_str());

	BOOL bFileExists;
	CFileFind cffFile;
	bFileExists= cffFile.FindFile(pszTemp, 0);

		bFileExists= cffFile.FindNextFile();

				// another directory
				CString cstrName, cstrPfad;
				cstrName= cffFile.GetFileName();
				cstrPfad= cffFile.GetFilePath();
				m_Burn.AddOrdner((LPCTSTR) cstrName);
				CreateFilelist((LPCTSTR) cstrPfad);
				CString cstrName, cstrPfad;
				cstrName= cffFile.GetFileName();
				cstrPfad= cffFile.GetFilePath();
				m_Burn.AddFile((LPCTSTR) cstrName, (LPCTSTR) cstrPfad);

	delete [] pszTemp;

m_Burn is my class, where nero is implemented. This function finds out all files (and subdirectories) in the given directory.

Each file is put into a list (member of class CBurn)

The second function creates an NeroIsoItem for each entry in this list and is a recursiv member-function of the class CBurn

	if(itDat == m_lstdatFiles.end())
		// no more entry in the list
		return NULL;

	NERO_ISO_ITEM* pniiThisItem;
	pniiThisItem= NULL;
	pniiThisItem= NeroCreateIsoItem();

	strcpy(pniiThisItem->fileName, (*itDat).strName.c_str());
	strcpy(pniiThisItem->sourceFilePath, (*itDat).strPfad.c_str());

	pniiThisItem->isDirectory=		FALSE;
	pniiThisItem->isReference=		FALSE;
	pniiThisItem->nextItem=			CreateISOTree(++itDat); // recursive call
	pniiThisItem->subDirFirstItem=	NULL;		
	return pniiThisItem;

somewhere else m_lstdatFiles and
DATEI are defined:

typedef struct tag_DATEI
	string	strName;
	string	strPfad;

typedef list<DATEI>			LISTDAT;
typedef LISTDAT::iterator	ITLISTDAT;


LISTDAT m_lstdatFiles;

the function call for the first NeroIsoItem is

NERO_ISO_ITEM* pniiFile;
pniiFile= ISOTreeErstellen(m_lstdatFiles.begin());

pass pniiFile to the NeroCreateIsoTrack function

I hope, that helps,


Hi Tim,

thanks for your Answer. Belongs the CreateFileList also to the m_Burn Class?

Can you mail me your entire Code (please)?


CreateFilelist doesn’t belong to the m_Burn class. It belongs to another class, where CBurn is a member. But you can add CreateFilelist to the class CBurn

Hi TimS,

thank you, but I don’t understand it, because I don’t no the relationship between the classes. You sent me a part of your code and it is difficult to understand, how you defined your classes.

(PS: I come also from Germany and we could write in german.)


Hello zavoshi,

use german here would not comfort the other users.

Send me your private email-adress (private message), and I’ll mail you the source of my projekt. But it will take a while.