Hi Everyone,
I'm working on my namespace extension (
http://swish.sourceforge.net/) and
I'm trying to pass data between IShellFolder instances. This data is the
current 'connection' to a remote server (a COM object). The idea is to
prevent users having to retype their password every time they navigate to
a subfolder, for instance.
So far, I've tried doing this by creating a 'pool' COM object and passing
its pointer to each subfolder in IShellFolder::BindToObject(). The
subfolder should then be able to fish the connection out of the pool and
use it.
This works for refreshing the same folder but doesn't seem to work for
any other scenario. What appears to happen is that navigating a
subfolder creates an entirely new instance of the (root) parent which, of
course, I haven't been able to pass the pointer to.
So, I thought the best way round this might be with an ATL singleton so I
never need to pass pointers around. However, I have read all sorts of
stuff that I don't really understand about why singletons are a bad idea
so I though I would ask you guys for advice. Is a singleton the way to
go? Where might I trip up? Is there a better way?