Click here to Skip to main content
15,915,160 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: displaying/hiding bitmaps in a MFC dialog Pin
Selevercin9-Jun-02 15:49
Selevercin9-Jun-02 15:49 
GeneralRe: displaying/hiding bitmaps in a MFC dialog Pin
PJ Arends9-Jun-02 15:53
professionalPJ Arends9-Jun-02 15:53 
GeneralRe: displaying/hiding bitmaps in a MFC dialog Pin
Selevercin9-Jun-02 16:32
Selevercin9-Jun-02 16:32 
GeneralRe: displaying/hiding bitmaps in a MFC dialog Pin
PJ Arends9-Jun-02 16:47
professionalPJ Arends9-Jun-02 16:47 
GeneralRe: displaying/hiding bitmaps in a MFC dialog Pin
Selevercin9-Jun-02 17:19
Selevercin9-Jun-02 17:19 
QuestionWhy can't the shell folder handle foreign characters? Pin
redeemer9-Jun-02 11:31
redeemer9-Jun-02 11:31 
AnswerRe: Why can't the shell folder handle foreign characters? Pin
Mike Nordell9-Jun-02 13:25
Mike Nordell9-Jun-02 13:25 
GeneralRe: Why can't the shell folder handle foreign characters? Pin
redeemer9-Jun-02 13:21
redeemer9-Jun-02 13:21 
Here's the function:

void AddFilesFromFolder(ITEMIDLIST *pIdl)
{
	if (pIdl)
	{
		IShellFolder *pBrowse = NULL;
		LPENUMIDLIST pFolder = NULL;
		LPMALLOC pMalloc = NULL;
		ITEMIDLIST *pNewId = NULL;
		ITEMIDLIST *pFullId;
		STRRET strDispName;
		STRRET strPrev;
		LVITEM lvItem;
		char szFolderPath[MAX_PATH+1];
		DWORD pActual = 0;
		DWORD dwAttrib;
		IShellFolder *CurrentFolder;

		if (SHGetDesktopFolder(&CurrentFolder) == NOERROR)
		{
			SHGetMalloc(&pMalloc);
			CurrentFolder->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
			pBrowse->GetDisplayNameOf(pIdl, SHGDN_INFOLDER, &strDispName);
			if (pBrowse->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder) == NOERROR)
			{
				SHGetPathFromIDList(pIdl, szFolderPath);
				pMalloc->Alloc((unsigned long)pNewId);

				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))
					{
						memset(strDispName.cStr, 0, MAX_PATH+1);
						pBrowse->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
						PathCombine(gszPath, szFolderPath, strDispName.cStr);

						if (strDispName.cStr[3] == '\0')
						{
							showstr(gszPath, &gszMsgBuff[strlen(gszMsgBuff)], 120);
							gszMsgBuff[strlen(gszMsgBuff)] = 13;
							gszMsgBuff[strlen(gszMsgBuff)] = 10;
						}

						if (FindHeader() != -1)
						{
							GetID3();
							FillInfo();
							ListAddItem();
						}

						pBrowse->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strPrev);
					}

					if (dwAttrib & SFGAO_FOLDER)
					{
					//From MSDN library
					UINT cb1 = GetSize(pIdl) - sizeof(pIdl->mkid.cb);
					UINT cb2 = GetSize(pNewId);

					pFullId = (LPITEMIDLIST)pMalloc->Alloc(cb1 + cb2);
					if (pFullId)
					{
						CopyMemory(pFullId, pIdl, cb1);
						CopyMemory(((LPSTR)pFullId) + cb1, pNewId, cb2);
						AddFilesFromFolder(pFullId); //Added
					} 
					//End From MSDN Library
					}
				}

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

			CurrentFolder->Release();
		}
	}
}


I got the initial PIDL from the SHBrowseForFolder function.
GeneralRe: Why can't the shell folder handle foreign characters? Pin
Mike Nordell9-Jun-02 13:35
Mike Nordell9-Jun-02 13:35 
GeneralRe: Why can't the shell folder handle foreign characters? Pin
redeemer9-Jun-02 13:47
redeemer9-Jun-02 13:47 
GeneralRe: Why can't the shell folder handle foreign characters? Pin
Michael Dunn9-Jun-02 15:28
sitebuilderMichael Dunn9-Jun-02 15:28 
GeneralRe: Why can't the shell folder handle foreign characters? Pin
Mike Nordell9-Jun-02 20:52
Mike Nordell9-Jun-02 20:52 
GeneralCFtpConnection::SetCurrentDirectory() Pin
Tony Fontenot9-Jun-02 10:40
Tony Fontenot9-Jun-02 10:40 
QuestionHow to change caption in VC++ Pin
9-Jun-02 10:01
suss9-Jun-02 10:01 
AnswerRe: How to change caption in VC++ Pin
Rama Krishna Vavilala9-Jun-02 9:56
Rama Krishna Vavilala9-Jun-02 9:56 
QuestionHow do i give my dialog an icon in the resource editor? Pin
redeemer9-Jun-02 9:47
redeemer9-Jun-02 9:47 
AnswerRe: How do i give my dialog an icon in the resource editor? Pin
Paul M Watt9-Jun-02 10:05
mentorPaul M Watt9-Jun-02 10:05 
GeneralRe: How do i give my dialog an icon in the resource editor? Pin
redeemer9-Jun-02 11:13
redeemer9-Jun-02 11:13 
AnswerRe: How do i give my dialog an icon in the resource editor? Pin
Ravi Bhavnani9-Jun-02 10:06
professionalRavi Bhavnani9-Jun-02 10:06 
GeneralSTL Container Sorting Pin
Paul M Watt9-Jun-02 8:55
mentorPaul M Watt9-Jun-02 8:55 
GeneralRe: STL Container Sorting Pin
9-Jun-02 11:03
suss9-Jun-02 11:03 
GeneralRe: STL Container Sorting Pin
Paul M Watt9-Jun-02 11:56
mentorPaul M Watt9-Jun-02 11:56 
GeneralRe: STL Container Sorting Pin
Mike Nordell9-Jun-02 11:30
Mike Nordell9-Jun-02 11:30 
GeneralRe: STL Container Sorting Pin
Paul M Watt9-Jun-02 11:51
mentorPaul M Watt9-Jun-02 11:51 
GeneralRe: STL Container Sorting Pin
Mike Nordell9-Jun-02 13:30
Mike Nordell9-Jun-02 13: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.