Click here to Skip to main content
15,923,789 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Copy files and directories with progress Dlg Pin
Nish Nishant20-May-02 6:30
sitebuilderNish Nishant20-May-02 6:30 
GeneralRe: Copy files and directories with progress Dlg Pin
Rick York20-May-02 6:43
mveRick York20-May-02 6:43 
GeneralBrowse Folder Pin
Mazdak20-May-02 5:45
Mazdak20-May-02 5:45 
GeneralRe: Browse Folder Pin
Daniel 'Tak' M.20-May-02 5:47
Daniel 'Tak' M.20-May-02 5:47 
GeneralRe: Browse Folder Pin
Mazdak20-May-02 8:46
Mazdak20-May-02 8:46 
GeneralRe: Browse Folder Pin
Renjith Ramachandran20-May-02 14:29
Renjith Ramachandran20-May-02 14:29 
GeneralRe: Browse Folder Pin
Mazdak21-May-02 20:25
Mazdak21-May-02 20:25 
GeneralUnhandled exeption when using shell functions Pin
redeemer20-May-02 5:07
redeemer20-May-02 5:07 
I'm getting an "Unhandled exeption" when running this function. I get it when it comes to the pBrowse->Next line. I have already tested if pBrowse is null and it isn't, neihter is pIdl. Here's the code
void OnOpenFolder()
{
	BROWSEINFO bi = {0};
	IShellFolder *pSf;
	LPMALLOC pMalloc;
	DWORD pActual = 0;

	bi.hwndOwner = ghWnd;
	bi.pidlRoot = NULL;
	bi.lpszTitle = "Locate MP3 Folder";
	bi.ulFlags = BIF_DONTGOBELOWDOMAIN;
	bi.lpfn = NULL;

	SHGetDesktopFolder (&pSf);

	if (pSf)
	{
		LPITEMIDLIST pIdl;

		pIdl = SHBrowseForFolder(&bi);
		if (pIdl)
		{
			IEnumIDList *pBrowse;
			SHGetMalloc(&pMalloc);
			pSf->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);

			pBrowse->AddRef();

			if (pBrowse)
			{
				while (pBrowse->Next(1, &pIdl, &pActual) == S_OK)
				{
					LVITEM Lvi = {0};
					char szPath[MAX_PATH+1];

					SHGetPathFromIDList(pIdl, szPath);
					Lvi.mask = LVIF_TEXT;
					Lvi.pszText = szPath;
					Lvi.iItem = SendMessage(DlgItems[7], LVM_GETITEMCOUNT, 0, 0);
					ListView_InsertItem(DlgItems[7], &Lvi);
				}
			}

			pBrowse->Release();
		}
		 		pMalloc->Free(pIdl);
		pMalloc->Release();
	}
	pSf->Release();
}


ghWnd is the hanlde to my window (yes, it's valid)
DlgItems[7] is the handle to a listview control, also valid.

Here's the exact error: "Unhandled exeption in app.exe (SHELL32.DLL): 0xC0000005: Access Violation."
Any help greatly appreciated

Thanks.
GeneralRe: Unhandled exeption when using shell functions Pin
Srini Kella20-May-02 6:38
Srini Kella20-May-02 6:38 
GeneralRe: Unhandled exeption when using shell functions Pin
Joaquín M López Muñoz20-May-02 6:47
Joaquín M López Muñoz20-May-02 6:47 
GeneralRe: Unhandled exeption when using shell functions Pin
redeemer20-May-02 7:11
redeemer20-May-02 7:11 
GeneralRe: Unhandled exeption when using shell functions Pin
Joaquín M López Muñoz20-May-02 9:51
Joaquín M López Muñoz20-May-02 9:51 
Generalwizzad still giving parse error line ; Pin
jimNLX20-May-02 5:07
jimNLX20-May-02 5:07 
GeneralRe: wizzad still giving parse error line ; Pin
Chris Losinger20-May-02 5:54
professionalChris Losinger20-May-02 5:54 
GeneralRe: wizzad still giving parse error line ; Pin
mystro_AKA_kokie20-May-02 7:27
mystro_AKA_kokie20-May-02 7:27 
GeneralRe: wizzad still giving parse error line ; Pin
jimNLX20-May-02 10:55
jimNLX20-May-02 10:55 
Questionhow to detect the primary thread ? Pin
20-May-02 4:07
suss20-May-02 4:07 
AnswerRe: how to detect the primary thread ? Pin
Bill Wilson21-May-02 5:43
Bill Wilson21-May-02 5:43 
GeneralMemory: debug vs. real world (2) Pin
Mike Osbahr20-May-02 3:55
Mike Osbahr20-May-02 3:55 
GeneralRe: Memory: debug vs. real world (2) Pin
Mike Nordell20-May-02 5:22
Mike Nordell20-May-02 5:22 
GeneralRe: Memory: debug vs. real world (2) Pin
Mike Osbahr21-May-02 2:26
Mike Osbahr21-May-02 2:26 
GeneralRe: Memory: debug vs. real world (2) Pin
Mike Nordell21-May-02 5:21
Mike Nordell21-May-02 5:21 
GeneralRe: Memory: debug vs. real world (2) Pin
Renjith Ramachandran20-May-02 14:38
Renjith Ramachandran20-May-02 14:38 
GeneralRe: Memory: debug vs. real world (2) Pin
Mike Osbahr21-May-02 2:39
Mike Osbahr21-May-02 2:39 
GeneralRe: Memory: debug vs. real world (2) Pin
Matt Gullett21-May-02 2:46
Matt Gullett21-May-02 2:46 

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.