Click here to Skip to main content
16,014,677 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCFileDialog assertion error Pin
Zizilamoroso28-May-02 3:41
Zizilamoroso28-May-02 3:41 
GeneralRe: CFileDialog assertion error Pin
Zizilamoroso28-May-02 3:49
Zizilamoroso28-May-02 3:49 
GeneralRe: CFileDialog assertion error Pin
Nish Nishant28-May-02 3:52
sitebuilderNish Nishant28-May-02 3:52 
GeneralRe: CFileDialog assertion error Pin
Zizilamoroso28-May-02 4:01
Zizilamoroso28-May-02 4:01 
GeneralRe: CFileDialog assertion error Pin
Nish Nishant28-May-02 3:51
sitebuilderNish Nishant28-May-02 3:51 
GeneralRe: CFileDialog assertion error Pin
Zizilamoroso28-May-02 3:55
Zizilamoroso28-May-02 3:55 
GeneralRe: CFileDialog assertion error Pin
Nish Nishant28-May-02 4:37
sitebuilderNish Nishant28-May-02 4:37 
GeneralEnumObjects returns error in recursive function Pin
redeemer28-May-02 3:28
redeemer28-May-02 3:28 
I have a function that takes the pidl of a folder and loops through all the files in the folder and if there is a folder i the folder it calls itself, else it adds the file to a listview control. This works ok the first time the function is run, but when i calls itself, the pBrowse->EnumObjects doesen't return NOERROR it returns -2147023673, can anyone help me? the pidl i pass in the function is a pidl gotten from the SHBrowseForFolder function, here is the function:

(ignore the text after the pre tag, something went wrong when i modfied the post.

void AddFilesFromFolder(ITEMIDLIST *pIdl)
{
	if (pIdl)
	{
		IShellFolder *pBrowse = NULL;
		LPENUMIDLIST pFolder = NULL;
		LPMALLOC pMalloc = NULL;
		ITEMIDLIST *pNewId = NULL;
		STRRET strDispName;
		LVITEM lvItem;
		RECT rMain;
		RECT rAdd;
		char szCurrentFile[MAX_PATH+1+5];
		char szFolderPath[MAX_PATH+1];
		DWORD pActual = 0;
		DWORD dwAttrib;
		IShellFolder *CurrentFolder;
		HRESULT err;

		err = SHGetDesktopFolder (&CurrentFolder);

		if (err == NOERROR)
		{
			SHGetMalloc(&pMalloc);
			CurrentFolder->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
			pBrowse->GetDisplayNameOf(pIdl, SHGDN_INFOLDER, &strDispName);
			err = pBrowse->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);
			if (err == NOERROR)
			{
				SHGetPathFromIDList(pIdl, szFolderPath);
				lvItem.mask = LVIF_IMAGE | LVIF_TEXT;

				while (pFolder->Next(1, &pNewId, &pActual) != S_FALSE)
				{
					dwAttrib = SFGAO_FOLDER;
					pBrowse->GetAttributesOf(1, (LPCITEMIDLIST*)&pNewId, &dwAttrib);
						
					if (!(dwAttrib & SFGAO_FOLDER))
					{
						pBrowse->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
						PathCombine(gszPath, szFolderPath, strDispName.cStr);

						GetID3();
						FillInfo();
						ListAddItem();
					}

					if (dwAttrib & SFGAO_FOLDER)
					{
						pBrowse->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
						AddFilesFromFolder(pNewId);
					}
				}

				pMalloc->Free(pNewId);
				pMalloc->Release();
				EndDialog(hDialog, true);
				gbFileOpen = true;
				pFolder->Release();
			}

			CurrentFolder->Release();
		}
	}
}
etDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
AddFilesFromFolder(pNewId);
}
}

pMalloc->Free(pNewId);
pMalloc->Release();
EndDialog(hDialog, true);
gbFileOpen = true;
pFolder->Release();
}

CurrentFolder->Release();
}
}
}

GeneralRe: Ignore this post something's wrong with it, i'll make another. Pin
Nish Nishant28-May-02 3:48
sitebuilderNish Nishant28-May-02 3:48 
GeneralRe: Ignore this post something's wrong with it, i'll make another. Pin
Zizilamoroso28-May-02 3:52
Zizilamoroso28-May-02 3:52 
GeneralRe: Ignore this post something's wrong with it, i'll make another. Pin
Alexandru Savescu28-May-02 4:18
Alexandru Savescu28-May-02 4:18 
Generalsorry for my interrupt! Pin
tiaozi28-May-02 3:23
tiaozi28-May-02 3:23 
GeneralRe: sorry for my interrupt! Pin
rrrado28-May-02 3:38
rrrado28-May-02 3:38 
GeneralRe: sorry for my interrupt! Pin
Nish Nishant28-May-02 3:45
sitebuilderNish Nishant28-May-02 3:45 
GeneralRe: sorry for my interrupt! Pin
Jason Gerard28-May-02 13:08
Jason Gerard28-May-02 13:08 
GeneralRe: sorry for my interrupt! Pin
tiaozi28-May-02 22:24
tiaozi28-May-02 22:24 
QuestionIErrorInfo or _com_error? Pin
28-May-02 1:32
suss28-May-02 1:32 
QuestionDisplaying Mathematical notation. How ?? Pin
28-May-02 1:23
suss28-May-02 1:23 
Generalstupid string queston Pin
bryce28-May-02 1:22
bryce28-May-02 1:22 
GeneralRe: stupid string queston Pin
-Dy28-May-02 1:29
-Dy28-May-02 1:29 
GeneralRe: stupid string queston Pin
markkuk28-May-02 2:30
markkuk28-May-02 2:30 
GeneralRe: stupid string queston Pin
bryce28-May-02 18:13
bryce28-May-02 18:13 
GeneralDrawing controls Pin
Hans Ruck28-May-02 0:39
Hans Ruck28-May-02 0:39 
GeneralRe: Drawing controls Pin
Prem Kumar28-May-02 1:14
Prem Kumar28-May-02 1:14 
GeneralRe: Drawing controls Pin
Rickard Andersson2028-May-02 2:21
Rickard Andersson2028-May-02 2:21 

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.