Click here to Skip to main content
16,010,918 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow can I set CFileDialog icons... Pin
23-Apr-01 23:33
suss23-Apr-01 23:33 
GeneralBuilding an Class Wizard looking Dialog Pin
23-Apr-01 20:16
suss23-Apr-01 20:16 
GeneralRe: Building an Class Wizard looking Dialog Pin
Manfred Ramosch23-Apr-01 22:03
Manfred Ramosch23-Apr-01 22:03 
QuestionWhy are my list box members null? Pin
23-Apr-01 16:51
suss23-Apr-01 16:51 
AnswerRe: Why are my list box members null? Pin
Michael Dunn23-Apr-01 20:09
sitebuilderMichael Dunn23-Apr-01 20:09 
GeneralReza Pin
23-Apr-01 16:36
suss23-Apr-01 16:36 
GeneralRe: Check Master Chris Maunder's code. Pin
Masaaki Onishi23-Apr-01 17:55
Masaaki Onishi23-Apr-01 17:55 
GeneralIShellFolder pointers, how to copy them safely... (COM) Pin
Henrik23-Apr-01 13:43
Henrik23-Apr-01 13:43 
Hello,

I got a small problem (or rather question)...



global:
-------
SHGetDesktopFolder(&m_pShellFolder)
// the nFolde value can be diffrent,, also CSIDL_DESKTOP.. depends what button user press
SHGetSpecialFolderLocation(NULL, nFolder, &m_ppidl);

func:
-----
IShellFolder* pFolder;
IEnumIDList* pEnumIds;

if (::GetSize(m_ppidl) == 2)
{
// if the user is in the root path (desktop folder) do this...

m_pShellFolder->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &pEnumIds);

pFolder = m_pShellFolder;

pFolder->AddRef();
}
else
{
// if the user is in a folder that is BELOW the desktop do this.... the pidl is
// a full path list in both cases (ie it holds the desktop id as first entry)

m_pShellFolder->BindToObject(m_ppidl, NULL, IID_IShellFolder, (LPVOID *)&pFolder);

pFolder->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &pEnumIds);
}

// after this the enumaration process starts and I use pFolder->GetAttributesOf
// and pFolder->GetDisplayNameOf...
.
.
.
pFolder->Release();

I got this code. Anyway as you might notice I do pFolder = m_pShellFolder.
My question is, can this be dangerous when I do pFolder->Release(); since both pointers point at the same memloc...?

(SIDENOTE)
If GetSize returns 2 I assume that the pidl tells you that your in the root (DESKTOP)
else your in a subfolder to the root
, my code is supposed to add to the pidl list as the user goes down in the folder structure..

(THE QUESTOIN Smile | :) )
So my question is, as I said, is it safe to do pFolder = m_pShellFolder; and then release pFolder later with pFolder->Release()?..

Will this destroy m_pShellFolder (or make it unusable) (it worked tough i dunno if its safe?)?

What im trying to accomplish is basicly to get a copy of the m_pShellFolder structure(the one it points at) to a new IShellFolder object..

I hope someone understood this Smile | :)

Cheers,
Henrik


GeneralRe: IShellFolder pointers, how to copy them safely... (COM) Pin
Michael Dunn23-Apr-01 15:49
sitebuilderMichael Dunn23-Apr-01 15:49 
GeneralVB Add-In Programming Pin
Jamie Nordmeyer23-Apr-01 10:53
Jamie Nordmeyer23-Apr-01 10:53 
Generalbook on ado via vc Pin
23-Apr-01 9:28
suss23-Apr-01 9:28 
GeneralRe: book on ado via vc Pin
23-Apr-01 10:15
suss23-Apr-01 10:15 
GeneralRe: book on ado via vc Pin
Brendan Tregear23-Apr-01 16:43
Brendan Tregear23-Apr-01 16:43 
GeneralSetWaitableTimer Pin
Joe O'Connor23-Apr-01 8:09
Joe O'Connor23-Apr-01 8:09 
GeneralAccess Violation Pin
23-Apr-01 6:57
suss23-Apr-01 6:57 
GeneralRe: Access Violation Pin
Tim Deveaux23-Apr-01 7:45
Tim Deveaux23-Apr-01 7:45 
GeneralSTL map warning messages Pin
Arun Saha23-Apr-01 5:27
Arun Saha23-Apr-01 5:27 
GeneralRe: STL map warning messages Pin
Michael Dunn23-Apr-01 5:37
sitebuilderMichael Dunn23-Apr-01 5:37 
GeneralRe: STL map warning messages Pin
AHa23-Apr-01 6:50
AHa23-Apr-01 6:50 
GeneralRe: STL map warning messages Pin
Michael Dunn23-Apr-01 15:53
sitebuilderMichael Dunn23-Apr-01 15:53 
GeneralDLL as a statically linked LIB file Pin
#realJSOP23-Apr-01 5:22
professional#realJSOP23-Apr-01 5:22 
GeneralRe: DLL as a statically linked LIB file Pin
Chris Meech23-Apr-01 5:42
Chris Meech23-Apr-01 5:42 
GeneralRe: DLL as a statically linked LIB file Pin
#realJSOP23-Apr-01 8:24
professional#realJSOP23-Apr-01 8:24 
QuestionHow to unbind a network protocol? Pin
23-Apr-01 5:02
suss23-Apr-01 5:02 
GeneralScreen Capture Pin
jerry0davis23-Apr-01 2:03
jerry0davis23-Apr-01 2:03 

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.