Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Browse network neighborhood

Browse network neighborhood

Scheduled Pinned Locked Moved C / C++ / MFC
comsysadminhelpquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RobJones
    wrote on last edited by
    #1

    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!

    H R R 3 Replies Last reply
    0
    • R RobJones

      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!

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      http://www.codeproject.com/treectrl/networktreectrl.asp[^] I hope helpful for you

      R 1 Reply Last reply
      0
      • R RobJones

        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!

        R Offline
        R Offline
        RobJones
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • H Hamid Taebi

          http://www.codeproject.com/treectrl/networktreectrl.asp[^] I hope helpful for you

          R Offline
          R Offline
          RobJones
          wrote on last edited by
          #4

          Thanks, I have looked at that before but I would prefer to use this other method. Whoever said nothing's impossible never tried slamming a revolving door!

          1 Reply Last reply
          0
          • R RobJones

            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!

            R Offline
            R Offline
            Ryan Binns
            wrote on last edited by
            #5

            Use SHGetSpecialFolderLocation() with the CSIDL_NETWORK flag to get the PIDL of the Network root folder, then pass this PIDL to SHBrowseForFolder() as the pidlRoot member of the BROWSEINFO 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"

            R 1 Reply Last reply
            0
            • R Ryan Binns

              Use SHGetSpecialFolderLocation() with the CSIDL_NETWORK flag to get the PIDL of the Network root folder, then pass this PIDL to SHBrowseForFolder() as the pidlRoot member of the BROWSEINFO 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"

              R Offline
              R Offline
              RobJones
              wrote on last edited by
              #6

              AWESOME! Thank you that is exactly what I needed! Whoever said nothing's impossible never tried slamming a revolving door!

              R 1 Reply Last reply
              0
              • R RobJones

                AWESOME! Thank you that is exactly what I needed! Whoever said nothing's impossible never tried slamming a revolving door!

                R Offline
                R Offline
                Ryan Binns
                wrote on last edited by
                #7

                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"

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups