Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 584869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:56:34+00:00 2026-05-13T14:56:34+00:00

Based on the answers I received at superuser , it’s clear that I’ll have

  • 0

Based on the answers I received at superuser, it’s clear that I’ll have to add the following to a custom Explorer Window launcher. I want to launch a rooted explorer view, and for just that window make the navigation pane look like the old Windows XP folders pane. I already wrote a program to place shortcuts to these folder views on the Start Menu, so changing the shortcuts to run through a launcher is trivial.

Here’s the XP folders pane:

Windows XP Explorer Folders Pane

Here’s the Windows 7 Navigation Pane:

Windows 7 Explorer Navigation Pane
(source: 280z28.org)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:56:35+00:00Added an answer on May 13, 2026 at 2:56 pm

    Okay well I haven’t got the time to completely finish this code (and it is in C# which I have no idea is what you want, but you didn’t really specify). The basic premise of this is hosting the ExplorerBrowser control inside a .NET Form (using the WindowsAPICodePack which you will need to get and add a reference to), wait around till the TreeView has been created and subclassing the window to allow us to intercept the item insertations.

    Unfortunately nothing is ever simple, the text doesn’t give you a direct idea of what the item is (cause they do not set it), what you would need to do is get the PIDL from the insertStruct.lParam and parse it into something meaningful, probably using the IShellFolder interface. You can then selectively remove items (by returning 0 as the m.Result) and you can intercept anything else you need to. You would think there would be a simple solution but I guess your luck isn’t in 😉 Hope it helps slightly.

    An alternative might be do similar (host explorer directly) but use something like detours to hook the registry functions and selectively change the view the explorer control gets allowing some of the registry tweaking to work.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Microsoft.WindowsAPICodePack.Shell;
    using System.Runtime.InteropServices;
    
    namespace MyExplorer
    {
        public partial class Form1 : Form
        {
            const int WH_CALLWNDPROC = 4;        
            const int WM_CREATE = 1;
    
            public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);
    
            [DllImport("user32.dll", CharSet = CharSet.Auto,
             CallingConvention = CallingConvention.StdCall)]
            public static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn,
            IntPtr hInstance, int threadId);
    
            [DllImport("user32.dll", CharSet = CharSet.Auto,
             CallingConvention = CallingConvention.StdCall)]
            public static extern bool UnhookWindowsHookEx(IntPtr hHook);
    
            [DllImport("user32.dll", CharSet = CharSet.Auto,
             CallingConvention = CallingConvention.StdCall)]
            public static extern int CallNextHookEx(IntPtr hHook, int nCode,
            IntPtr wParam, IntPtr lParam);
    
            [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
            static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
    
            IntPtr m_hHook;
            HookProc HookDelegate;
    
            struct WindowHookStruct
            {            
                public IntPtr lParam;
                public IntPtr wParam;
                public uint   message;
                public IntPtr hwnd;
            }
    
            public class SubclassTreeView : NativeWindow
            {           
                const int TV_FIRST = 0x1100;
                //const int TVM_INSERTITEMA = (TV_FIRST + 0);
                const int TVM_INSERTITEMW = (TV_FIRST + 50);
    
                struct TVINSERTSTRUCTW 
                {
                   public IntPtr hParent;
                   public IntPtr hInsertAfter;    
                   /* TVITEMW */
                   public uint mask;
                   public IntPtr hItem;
                   public uint state;
                   public uint stateMask;
                   public IntPtr pszText;
                   public int cchTextMax;
                   public int iImage;
                   public int iSelectedImage;
                   public int cChildren;
                   public IntPtr lParam;
                }
    
                int count = 0;
    
                protected override void WndProc(ref Message m)
                {                
                    bool bHandled = false;                             
    
                    switch (m.Msg)
                    {
                        case TVM_INSERTITEMW:                        
                            TVINSERTSTRUCTW insertStruct = (TVINSERTSTRUCTW)Marshal.PtrToStructure(m.LParam, typeof(TVINSERTSTRUCTW));
    
                            /* Change text to prove a point */
                            string name = String.Format("{0:X} {1} Hello", insertStruct.hParent.ToInt64(), count++);
                            insertStruct.pszText = Marshal.StringToBSTR(name);
                            insertStruct.cchTextMax = name.Length+1;
                            Marshal.StructureToPtr(insertStruct, m.LParam, false);                        
    
                            /* insertStruct.lParam is a pointer to a IDL, 
                               use IShellFolder::GetDisplayNameOf to pull out a sensible 
                               name to work out what to hide */
                            /* Uncomment this code to delete the entry */
                            //bHandled = true;
                            //m.Result = IntPtr.Zero;                                                  
                            break;
                    }
    
                    if (!bHandled)
                    {
                        base.WndProc(ref m);
                    }
                }
            }
    
            /* Not complete structure, don't need it */
            struct MSG
            {
                public IntPtr hwnd;
                public uint   message;
                public IntPtr wParam;
                public IntPtr lParam;   
            }
    
            SubclassTreeView sc = null;
    
            public Form1()
            {
                InitializeComponent();
                HookDelegate = new HookProc(HookWindowProc);
                m_hHook = SetWindowsHookEx(WH_CALLWNDPROC, HookDelegate, (IntPtr)0, AppDomain.GetCurrentThreadId());
            }
    
            int HookWindowProc(int nCode, IntPtr wParam, IntPtr lParam)
            {           
                if (nCode < 0)
                {
                    return CallNextHookEx(m_hHook, nCode, wParam, lParam);
                }
                else
                {
    
                    WindowHookStruct hookInfo = (WindowHookStruct)Marshal.PtrToStructure(lParam, typeof(WindowHookStruct));
                    StringBuilder sb = new StringBuilder(1024);
    
                    if (hookInfo.message == WM_CREATE)
                    {
                        if (GetClassName(hookInfo.hwnd, sb, 1024) > 0)
                        {
                            System.Diagnostics.Debug.WriteLine(sb.ToString());
                            if (sb.ToString() == "SysTreeView32")
                            {
                                sc = new SubclassTreeView();
                                sc.AssignHandle(hookInfo.hwnd);
                                UnhookWindowsHookEx(m_hHook);
                            }
                        }
                    }
    
                    return CallNextHookEx(m_hHook, nCode, wParam, lParam);                
                }
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {                        
                explorerBrowser1.Navigate(ShellLink.FromParsingName("C:\\"));
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: Based on a couple of the answers I have received, I just want
Based on the helpful answers I received here , I created the following script,
Based on some answers to this question it appears that +alloc does some behind-the-scenes
Based on the answer I received on this question ( https://stackoverflow.com/questions/1911969/... ) I have
Note: Edited based on responses to receive more appropriate answers. I have a collection
It's a basic website. Based off answers on here, I'm doing this: private $db;
Update: Based on the answers I initially went the route of using IsInstanceOf() which
EDIT 2 Okay, based on the advice on the answers below I eliminated my
I have a REST service built using Jersey. I want to be able to
I'm writing a program that will have both a server side and a client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.