Click here to Skip to main content
15,913,773 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Adding an ActiveX control in ActiveX control project Pin
jmkhael9-Sep-04 4:35
jmkhael9-Sep-04 4:35 
GeneralRe: Adding an ActiveX control in ActiveX control project Pin
Muhammad Azam9-Sep-04 19:25
Muhammad Azam9-Sep-04 19:25 
Generalinheritance,searching and recursion Pin
Member 13550639-Sep-04 3:48
Member 13550639-Sep-04 3:48 
GeneralRe: inheritance,searching and recursion Pin
David Crow9-Sep-04 8:29
David Crow9-Sep-04 8:29 
GeneralDinamic Menus Pin
ivax9-Sep-04 2:33
ivax9-Sep-04 2:33 
QuestionHow to change the menu bar icon.... Pin
bouli9-Sep-04 1:48
bouli9-Sep-04 1:48 
AnswerRe: How to change the menu bar icon.... Pin
Roger Allen9-Sep-04 11:40
Roger Allen9-Sep-04 11:40 
Questionis there a memory limitation for MFC programs? Pin
lonely_life9-Sep-04 0:52
lonely_life9-Sep-04 0:52 
the following is part of code from Nero SDK (NeroCmd), which recursively generate a ISO tree for buring, the main concept is finding all subfolder & folders of passed in directory "psFilename", this code works fine under console mode, but when I tried to put it to my MFC project my program always auto close due to it, but sometimes my code could get through without any modification, anybody knows what is going on here? is that because there's a memory limitation for MFC dialog application, due to the recursion here.

CExitCode CBurnContext::CreateIsoTree (const PARAMETERS & params, LPCSTR psFilename, NERO_ISO_ITEM ** ppItem, int iLevel)
{
// CFindFiles is a helper class for file and subdirectory handling

CFindFiles ff (psFilename);

*ppItem = NULL;

if (!ff.IsValidEntry())
{
if (0 == iLevel)
{
// If we haven't found any entries and we are on the
// first level of recursion then this should be
// reported as an error.

m_ErrorLog.printf ("File specification '%s' resulted in no matches!\n", psFilename);

return EXITCODE_FILE_NOT_FOUND;
}
else
{
// If we are on a level other than first, it is ok
// not to find any entries. This simply means we
// stumbled upon an empty directory somewhere in a tree.

return EXITCODE_OK;
}
}

char sPath[MAX_PATH];

// Make sure that we have no relative path names, but only absolute paths

if (NULL == _fullpath (sPath, psFilename, sizeof (sPath)))
{
// Our path buffer is too small. Bail out!

return EXITCODE_INTERNAL_ERROR;
}

// Find the last blackslash and remove it if found.
// This will leave us with a root directory.

LPSTR psBackslash = strrchr (sPath, '\\');
if (NULL != psBackslash)
{
*psBackslash = '\0';
}

do
{
std::string sNewPath;

sNewPath = sPath;

sNewPath += "\\";
sNewPath += ff.GetName ();

if (ff.IsSubDir())
{
// Here we handle subdirectories

// strcmp returns 0 on equal strings.
// Proceed if name contains none of "." or ".."

if ((0 != strcmp (ff.GetName (), ".")) && (0 != strcmp (ff.GetName (), "..")))
{
// Append a wildcard to the path and do a recursive search.

sNewPath += "\\";
sNewPath += ff.GetWildcard ();

NERO_ISO_ITEM * pNewItem = NeroCreateIsoItem ();
if (NULL == pNewItem)
{
DeleteIsoItemTree (*ppItem);
return EXITCODE_OUT_OF_MEMORY;
}

// Attach this item to the beginning of the list.

if (*ppItem != NULL)
{
pNewItem->nextItem = *ppItem;
}
*ppItem = pNewItem;

pNewItem->isDirectory = TRUE;
time_t t = ff.GetCreateTime ();
pNewItem->entryTime = *localtime (&t);

StoreFileName (pNewItem->fileName, pNewItem->longFileName, ff.GetName ());

// If we the user wants recursive search, only then do we
// actually recurse at deeper levels otherwise ignore directories
// alltogether.
//
if (params.GetRecursive ())
{
// Create an ISO item tree at a deeper level

EXITCODE code = CreateIsoTree (params, sNewPath.c_str (), &pNewItem->subDirFirstItem, iLevel + 1);
if (EXITCODE_OK != code)
{
DeleteIsoItemTree (*ppItem);
return code;
}

// We don't allow empty directories. This should probably
// be regulated by a command line switch.
//
if (pNewItem->subDirFirstItem == NULL)
{
// If the newly added directory is empty, remove it!
// We first detach it from the list and then
// deallocate it.
//
*ppItem = pNewItem->nextItem;
pNewItem->nextItem = NULL;
DeleteIsoItemTree (pNewItem);
}
}
}
}
else
{
// Here we handle regular files

NERO_ISO_ITEM * pNewItem = NeroCreateIsoItem ();
if (NULL == pNewItem)
{
DeleteIsoItemTree (*ppItem);
return EXITCODE_OUT_OF_MEMORY;
}

StoreFileName (pNewItem->sourceFilePath, (char *) pNewItem->longSourceFilePath, sNewPath.c_str ());

pNewItem->isDirectory = FALSE;
time_t t = ff.GetCreateTime ();
pNewItem->entryTime = *localtime (&t);

StoreFileName (pNewItem->fileName, pNewItem->longFileName, ff.GetName ());

// Attach this item to the beginning of the list.

if (*ppItem != NULL)
{
pNewItem->nextItem = *ppItem;
}
*ppItem = pNewItem;
}

ff.FindNext ();
}
while (ff.IsValidEntry ());

return EXITCODE_OK;
}
AnswerRe: is there a memory limitation for MFC programs? Pin
vineas9-Sep-04 6:34
vineas9-Sep-04 6:34 
GeneralNot Running when adding RIch Edit Box to a Dialog Pin
pubududilena9-Sep-04 0:44
pubududilena9-Sep-04 0:44 
GeneralRe: Not Running when adding RIch Edit Box to a Dialog Pin
Arsalan Malik9-Sep-04 0:48
Arsalan Malik9-Sep-04 0:48 
GeneralRe: Not Running when adding RIch Edit Box to a Dialog Pin
David Crow9-Sep-04 2:19
David Crow9-Sep-04 2:19 
GeneralCreate Thumbnail of MS WORD file Pin
Sumit Kapoor9-Sep-04 0:07
Sumit Kapoor9-Sep-04 0:07 
GeneralDebugging with Visual Studio .NET Pin
Jerome Conus8-Sep-04 23:32
Jerome Conus8-Sep-04 23:32 
GeneralRe: Debugging with Visual Studio .NET Pin
Michael Dunn9-Sep-04 7:10
sitebuilderMichael Dunn9-Sep-04 7:10 
QuestionHow to create a autofill utility Pin
akszn8-Sep-04 23:02
akszn8-Sep-04 23:02 
GeneralGetting Page Size and then Printing Text. Pin
Eversman8-Sep-04 21:52
Eversman8-Sep-04 21:52 
GeneralApplication Installation once only. Pin
Mythri.B.L8-Sep-04 21:18
Mythri.B.L8-Sep-04 21:18 
GeneralRe: Application Installation once only. Pin
David Crow9-Sep-04 2:31
David Crow9-Sep-04 2:31 
GeneralRe: Application Installation once only. Pin
Anonymous9-Sep-04 19:26
Anonymous9-Sep-04 19:26 
QuestionHow to Use Object of MFC class in ATL DLL Pin
zahid_ash8-Sep-04 21:00
zahid_ash8-Sep-04 21:00 
GeneralHide Static Text Pin
Rajesh_K_Sharma8-Sep-04 20:15
Rajesh_K_Sharma8-Sep-04 20:15 
GeneralRe: Hide Static Text Pin
LOUIS Christian8-Sep-04 21:30
LOUIS Christian8-Sep-04 21:30 
GeneralRe: Hide Static Text Pin
David Crow9-Sep-04 2:36
David Crow9-Sep-04 2:36 
Generalhelp!!help,how to use IVMRWindowlessControl9. Pin
yingkou8-Sep-04 19:18
yingkou8-Sep-04 19:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.