Browse network neighborhood
-
Hello, I am to do something as simple as browse the network neighborhood and return the path selected... After a bunch of research the only thing I found that really fits my needs is an article by Paul DiLascia. http://msdn.microsoft.com/msdnmag/issues/05/06/CAtWork/ Anyway, I am trying to modify his code to only display the network neighborhood and nothing else... He provides 2 functions for filtering out items. I have been playing around with this for hours and I can't seem to figure it out. Can anyone help me out? I only want to display the network neighborhood.
// Used for custom filtering. You must override to specify filter flags.
HRESULT CFolderDialog::OnGetEnumFlags(
IShellFolder* psf, // this folder's IShellFolder
LPCITEMIDLIST pidlFolder, // folder's PIDL
DWORD *pgrfFlags) // [out] return flags you want to allow
{
BFTRACE(_T("CFolderDialog::OnGetEnumFlags(%p): %s\n"),
psf, GetPathName(pidlFolder));return S\_OK;
}
// Used for custom filtering. You must override to filter items.
HRESULT CFolderDialog::OnShouldShow(
IShellFolder* psf, // This folder's IShellFolder
LPCITEMIDLIST pidlFolder, // PIDL for folder containing item
LPCITEMIDLIST pidlItem) // PIDL for item
{
BFTRACE(_T("CFolderDialog::OnShouldShow(%p): %s: %s\n"), psf,
GetDisplayNameOf(psf, pidlFolder, SHGDN_NORMAL),
GetDisplayNameOf(psf, pidlItem, SHGDN_NORMAL));return S\_OK;
}
Whoever said nothing's impossible never tried slamming a revolving door!
-
Hello, I am to do something as simple as browse the network neighborhood and return the path selected... After a bunch of research the only thing I found that really fits my needs is an article by Paul DiLascia. http://msdn.microsoft.com/msdnmag/issues/05/06/CAtWork/ Anyway, I am trying to modify his code to only display the network neighborhood and nothing else... He provides 2 functions for filtering out items. I have been playing around with this for hours and I can't seem to figure it out. Can anyone help me out? I only want to display the network neighborhood.
// Used for custom filtering. You must override to specify filter flags.
HRESULT CFolderDialog::OnGetEnumFlags(
IShellFolder* psf, // this folder's IShellFolder
LPCITEMIDLIST pidlFolder, // folder's PIDL
DWORD *pgrfFlags) // [out] return flags you want to allow
{
BFTRACE(_T("CFolderDialog::OnGetEnumFlags(%p): %s\n"),
psf, GetPathName(pidlFolder));return S\_OK;
}
// Used for custom filtering. You must override to filter items.
HRESULT CFolderDialog::OnShouldShow(
IShellFolder* psf, // This folder's IShellFolder
LPCITEMIDLIST pidlFolder, // PIDL for folder containing item
LPCITEMIDLIST pidlItem) // PIDL for item
{
BFTRACE(_T("CFolderDialog::OnShouldShow(%p): %s: %s\n"), psf,
GetDisplayNameOf(psf, pidlFolder, SHGDN_NORMAL),
GetDisplayNameOf(psf, pidlItem, SHGDN_NORMAL));return S\_OK;
}
Whoever said nothing's impossible never tried slamming a revolving door!
http://www.codeproject.com/treectrl/networktreectrl.asp[^] I hope helpful for you
-
Hello, I am to do something as simple as browse the network neighborhood and return the path selected... After a bunch of research the only thing I found that really fits my needs is an article by Paul DiLascia. http://msdn.microsoft.com/msdnmag/issues/05/06/CAtWork/ Anyway, I am trying to modify his code to only display the network neighborhood and nothing else... He provides 2 functions for filtering out items. I have been playing around with this for hours and I can't seem to figure it out. Can anyone help me out? I only want to display the network neighborhood.
// Used for custom filtering. You must override to specify filter flags.
HRESULT CFolderDialog::OnGetEnumFlags(
IShellFolder* psf, // this folder's IShellFolder
LPCITEMIDLIST pidlFolder, // folder's PIDL
DWORD *pgrfFlags) // [out] return flags you want to allow
{
BFTRACE(_T("CFolderDialog::OnGetEnumFlags(%p): %s\n"),
psf, GetPathName(pidlFolder));return S\_OK;
}
// Used for custom filtering. You must override to filter items.
HRESULT CFolderDialog::OnShouldShow(
IShellFolder* psf, // This folder's IShellFolder
LPCITEMIDLIST pidlFolder, // PIDL for folder containing item
LPCITEMIDLIST pidlItem) // PIDL for item
{
BFTRACE(_T("CFolderDialog::OnShouldShow(%p): %s: %s\n"), psf,
GetDisplayNameOf(psf, pidlFolder, SHGDN_NORMAL),
GetDisplayNameOf(psf, pidlItem, SHGDN_NORMAL));return S\_OK;
}
Whoever said nothing's impossible never tried slamming a revolving door!
Actually I have to override these functions.. Here is the following but I am still unsure on how to filter...
//////////////////
// Get flags for custom filtering: Only enumerate folders. This is only
// called when custom filtering is used.
//
HRESULT CMyFolderDialog::OnGetEnumFlags(IShellFolder* psf, LPCITEMIDLIST pidlFolder,
DWORD *pgrfFlags)
{
BFTRACE(_T("CMyFolderDialog::OnGetEnumFlags\n"));\*pgrfFlags = SHCONTF\_FOLDERS; // show only folders return S\_OK;
}
//////////////////
// Determine whether to display item: doesn't actually do anything, just
// illustrates the function in action through TRACE diagnostics.
//
HRESULT CMyFolderDialog::OnShouldShow(IShellFolder* psf,
LPCITEMIDLIST pidlFolder,
LPCITEMIDLIST pidlItem)
{
BFTRACE(_T("CMyFolderDialog::OnShouldShow(%p): %s: %s"),
psf, GetPathName(pidlFolder), GetDisplayNameOf(psf, pidlItem, SHGDN_NORMAL));SFGAOF attrs; psf->GetAttributesOf(1, &pidlItem, &attrs); BOOL bShow = attrs & (SFGAO\_FILESYSTEM | SFGAO\_HASSUBFOLDER); BFTRACE(\_T(" \[attrs: %08x\]: %s\\n"), attrs, bShow ? \_T("Yes") : \_T("No")); return bShow ? S\_OK : S\_FALSE;
}
Whoever said nothing's impossible never tried slamming a revolving door!
-
http://www.codeproject.com/treectrl/networktreectrl.asp[^] I hope helpful for you
-
Hello, I am to do something as simple as browse the network neighborhood and return the path selected... After a bunch of research the only thing I found that really fits my needs is an article by Paul DiLascia. http://msdn.microsoft.com/msdnmag/issues/05/06/CAtWork/ Anyway, I am trying to modify his code to only display the network neighborhood and nothing else... He provides 2 functions for filtering out items. I have been playing around with this for hours and I can't seem to figure it out. Can anyone help me out? I only want to display the network neighborhood.
// Used for custom filtering. You must override to specify filter flags.
HRESULT CFolderDialog::OnGetEnumFlags(
IShellFolder* psf, // this folder's IShellFolder
LPCITEMIDLIST pidlFolder, // folder's PIDL
DWORD *pgrfFlags) // [out] return flags you want to allow
{
BFTRACE(_T("CFolderDialog::OnGetEnumFlags(%p): %s\n"),
psf, GetPathName(pidlFolder));return S\_OK;
}
// Used for custom filtering. You must override to filter items.
HRESULT CFolderDialog::OnShouldShow(
IShellFolder* psf, // This folder's IShellFolder
LPCITEMIDLIST pidlFolder, // PIDL for folder containing item
LPCITEMIDLIST pidlItem) // PIDL for item
{
BFTRACE(_T("CFolderDialog::OnShouldShow(%p): %s: %s\n"), psf,
GetDisplayNameOf(psf, pidlFolder, SHGDN_NORMAL),
GetDisplayNameOf(psf, pidlItem, SHGDN_NORMAL));return S\_OK;
}
Whoever said nothing's impossible never tried slamming a revolving door!
Use
SHGetSpecialFolderLocation()
with theCSIDL_NETWORK
flag to get the PIDL of the Network root folder, then pass this PIDL toSHBrowseForFolder()
as thepidlRoot
member of theBROWSEINFO
structure. This will force the "Browse For Folder" tree to be rooted at the root network folder.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Use
SHGetSpecialFolderLocation()
with theCSIDL_NETWORK
flag to get the PIDL of the Network root folder, then pass this PIDL toSHBrowseForFolder()
as thepidlRoot
member of theBROWSEINFO
structure. This will force the "Browse For Folder" tree to be rooted at the root network folder.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
AWESOME! Thank you that is exactly what I needed! Whoever said nothing's impossible never tried slamming a revolving door!
You're welcome :)
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"