ShellTreeView (or) Other, You decide

Posted on 2004-11-14
Last Modified: 2010-04-05
Hello All;

   Is their a way in a ShellTreeView to display Only
The Folder that are located in the Main Folder of the program?

   The program is installed in:
   C:\Program Files\My Program\
   Sub Folders in the [My Program] folder are:
   My Utilities | My Pictures | My Personal | My What Ever Else.
{ so on, and on }

   Is their a way to make the Shell only show what is contained in
[My Program] Folder. And not the entire computer.
And no way to browse outside of the [My Program] folder?

Thank You
Question by:Wayne Barron
    LVL 17

    Accepted Solution

    Wouldn't you have to assign the root for this?


    Yep. Assign 'C:\Program Files\My Program' to the ShellTreeView.Root and all you see is every folder with this one as root... And use ExtractFilePath(ParamStr(0)) to set the folder of your application as root.
    LVL 30

    Author Comment

    by:Wayne Barron
    how would this be accomplished if say.
    The user was to install the program into

    D:\My Program\....
    E:\Program Files\My Program

    And so forth.
      Is there a way to code it to where it will pick up on any Root?
    Depending on User-Install prefrence?

    Can you Alex, or someone make a example up of something like this?

    LVL 14

    Assisted Solution

    In that case, you need to find the folder of the .exe:

    ShellTreeView1.Root := ExtractFilePath(ParamStr(0));

    * Alex should get the point for pointing out the Root property
    LVL 30

    Author Comment

    by:Wayne Barron
    Thank you both [Alex & Slayer];

      I added it in like so:

    ShellTreeView1.Root := ExtractFilePath(ParamStr(0));

    1 more question right quick, just to let me know if this is suppose to do it.

      This is the way that the folder is going right now, to the sample project that I just tested it on, as a quicky.

      E:\Delphi Codes\Project\Project.exe file here with codes of course.

    When program opens it shows this
       Delphi Codes  <-- Main Folder
          Test                <-- A test folder a made

    Now in the [Delphi Codes] Folder itself their is about 15 other folder
    But they are not shown.

       So this is my question:?

       Is it suppose to show the Main Supporting folder.
       And have it as your main?
    Like in my case it is the [Delphi Codes] Folder

    Thanks guys.
    I will split the points, because you both helped.

    LVL 30

    Author Comment

    by:Wayne Barron
    never mind.
    I just re-read Alex's post, and he states
    [you see is every folder with this one as root]

    So that answers my question.

    Take Care Guys.


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    This video discusses moving either the default database or any database to a new volume.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now