Click here to Skip to main content
15,909,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
I'm not quite sure, but here's my code now, with the IID_IShellFolder parameter in BindToObjet it works, but with the IID_IEnumIDList i get that unhandled exception.
void OnOpenFolder()
{
	BROWSEINFO bi = {0};
	IShellFolder *pSf;
	LPMALLOC pMalloc;
	LPENUMIDLIST pFolder = NULL;
	DWORD pActual = 0;
	LVITEM Lvi = {0};
	char szFolderPath[MAX_PATH+1];

	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);
		SHGetPathFromIDList(pIdl, szFolderPath);
		Lvi.mask = LVIF_TEXT;
		Lvi.pszText = szFolderPath;
		Lvi.iItem = SendMessage(DlgItems[7], LVM_GETITEMCOUNT, 0, 0);
		ListView_InsertItem(DlgItems[7], &Lvi);

		if (pIdl)
		{
			IShellFolder *pBrowse = NULL;

			SHGetMalloc(&pMalloc);
			pSf->BindToObject(pIdl, NULL, IID_IEnumIDList, (LPVOID*)&pBrowse);
			pSf->Release();

			pBrowse->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);

			if (pBrowse)
			{
				while (pFolder->Next(1, &pIdl, &pActual) == S_OK)
				{

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

			pBrowse->Release();
		}

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


Although there still is a problem. The SHGetPathFromIDList(pIdl, szFolderPath); sets the szFolderPath to <desktop folder="">\<one of="" the="" subfolders="" in="" folder="" i="" chose="" via="" shbrowseforfolder="">

Thanks
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 
GeneralRe: Memory: debug vs. real world (2) Pin
Mike Osbahr21-May-02 2:58
Mike Osbahr21-May-02 2:58 
GeneralRe: Memory: debug vs. real world (2) Pin
Matt Gullett21-May-02 3:13
Matt Gullett21-May-02 3:13 
GeneralRe: Memory: debug vs. real world (2) Pin
Mike Osbahr21-May-02 3:30
Mike Osbahr21-May-02 3:30 

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.