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


Commercial message



Nero SDK Discussion Forum Discuss, burning directories with NeroAPI at International Chat: Software related forum; Hi, 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


Reply
 
Thread Tools
Old 23-10-2003   #1 (permalink)
New on Forum
 
Join Date: Oct 2003
Posts: 8
burning directories with NeroAPI

Hi,

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?
zavoshi is offline   Reply With Quote
Old 23-10-2003   #2 (permalink)
New on Forum
 
Join Date: Oct 2003
Location: Germany
Posts: 11
Hi,

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.
TimS is offline   Reply With Quote
Old 24-10-2003   #3 (permalink)
New on Forum
 
Join Date: Oct 2003
Posts: 8
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) ?
zavoshi is offline   Reply With Quote
Old 24-10-2003   #4 (permalink)
New on Forum
 
Join Date: Oct 2003
Location: Germany
Posts: 11
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
c:\\Burn\\FolderA\\File1
c:\\Burn\\FolderA\\File2
c:\\Burn\\FolderB\\File3
c:\\Burn\\File4

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

FolderA
->fileName= "FolderA" (use strcpy)
->sourceFilePath= "" (use strcpy)
->isDirectory= TRUE
->subDirFirstItem= (Pointer to IsoItem struct of 'File1')
->nextItem= (Pointer to IsoItem-struct of 'FolderB')

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

...

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

create each IsoItem like this;
Code:
NERO_ISO_ITEM* pItem;
pItem= NeroCreateIsoItem();
pass the first IsoItem (FolderA) to the NeroCreateIsoTrackEx-Function

after burning, free the memory with
Code:
NeroFreeIsoItemTree(...)
(pass the first item to this function)

I hope this helps,
greetings
Tim
TimS is offline   Reply With Quote
Old 24-10-2003   #5 (permalink)
New on Forum
 
Join Date: Oct 2003
Posts: 8
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.

greetings

zavoshi
zavoshi is offline   Reply With Quote
Old 24-10-2003   #6 (permalink)
New on Forum
 
Join Date: Oct 2003
Location: Germany
Posts: 11
Hello zavoshi,

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

Code:
CFileFind cffFile;
cffFile.FindFile("c:\\test\\*.*");
while(cffFile.FindNextFile())
{
      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,
greetings,
Tim
TimS is offline   Reply With Quote
Old 24-10-2003   #7 (permalink)
New on Forum
 
Join Date: Oct 2003
Location: Germany
Posts: 11
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,
Tim
TimS is offline   Reply With Quote
Old 24-10-2003   #8 (permalink)
New on Forum
 
Join Date: Oct 2003
Posts: 8
Hi TimS,

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


Code:

--------------------------------------------------------------
{
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;
medtFileName.SetWindowText(mstrPathName);

MessageBox(path);
if (pndiDeviceInfos->nsdisNumDevInfos > 0)
{

mbtnBurn.EnableWindow(true);
}

}
}

}
---------------------------------------------------------------

Have a nice weekend.
zavoshi is offline   Reply With Quote
Old 27-10-2003   #9 (permalink)
New on Forum
 
Join Date: Oct 2003
Posts: 8
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?

greeting

zavoshi
zavoshi is offline   Reply With Quote
Old 27-10-2003   #10 (permalink)
New on Forum
 
Join Date: Oct 2003
Location: Germany
Posts: 11
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:

Code:
// 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);

	while(bFileExists)
	{
		bFileExists= cffFile.FindNextFile();

		if(!cffFile.IsDots())
		{
			if(cffFile.IsDirectory())
			{
				// another directory
				CString cstrName, cstrPfad;
				cstrName= cffFile.GetFileName();
				cstrPfad= cffFile.GetFilePath();
				m_Burn.AddOrdner((LPCTSTR) cstrName);
				CreateFilelist((LPCTSTR) cstrPfad);
				m_Burn.CloseOrdner();
			}
			else
			{
				CString cstrName, cstrPfad;
				cstrName= cffFile.GetFileName();
				cstrPfad= cffFile.GetFilePath();
				m_Burn.AddFile((LPCTSTR) cstrName, (LPCTSTR) cstrPfad);
			}
		}
	}

	cffFile.Close();
	delete [] pszTemp;
	return;
}
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
Code:
NERO_ISO_ITEM*	CBurn::CreateISOTree(ITLISTDAT& itDat)
{
	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:
Code:
typedef struct tag_DATEI
{
	string	strName;
	string	strPfad;
} DATEI;

typedef list			LISTDAT;
typedef LISTDAT::iterator	ITLISTDAT;

...

LISTDAT m_lstdatFiles;
the function call for the first NeroIsoItem is
Code:
NERO_ISO_ITEM* pniiFile;
pniiFile= ISOTreeErstellen(m_lstdatFiles.begin());
pass pniiFile to the NeroCreateIsoTrack function

I hope, that helps,

greetings,
Tim

Last edited by TimS; 28-10-2003 at 08:41.
TimS is offline   Reply With Quote
Old 27-10-2003   #11 (permalink)
New on Forum
 
Join Date: Oct 2003
Posts: 8
Hi Tim,

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

Can you mail me your entire Code (please)?
zavoshi is offline   Reply With Quote
Old 28-10-2003   #12 (permalink)
New on Forum
 
Join Date: Oct 2003
Location: Germany
Posts: 11
No,

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
TimS is offline   Reply With Quote
Old 28-10-2003   #13 (permalink)
New on Forum
 
Join Date: Oct 2003
Posts: 8
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.)

thanks
zavoshi is offline   Reply With Quote
Old 28-10-2003   #14 (permalink)
New on Forum
 
Join Date: Oct 2003
Location: Germany
Posts: 11
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.

greetings,
tim
TimS is offline   Reply With Quote
 
Reply

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
NeroAPI crashes burning a DVD Rupella Nero SDK Discussion Forum 1 21-04-2006 16:58
Burning directories and file Recursive zikman Nero SDK Discussion Forum 1 12-07-2005 07:22
NeroCMD: burning multiple directories/files burning snow Nero SDK Discussion Forum 9 24-08-2004 23:03
Burning directories rcortes Nero SDK Discussion Forum 3 23-10-2003 10:12
Burning DVD-Video with NeroAPI VPCoder Nero SDK Discussion Forum 3 24-06-2003 13:46


All times are GMT +2. The time now is 20:37.


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