Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aont/3060a1be77bb5631420ecff7c4e465aa to your computer and use it in GitHub Desktop.

Select an option

Save aont/3060a1be77bb5631420ecff7c4e465aa to your computer and use it in GitHub Desktop.

Articles and Threads That Actually Operate or Test explorer.exe Windows and Tabs Using SendMessage / PostMessage

This collection gathers articles and threads—mainly in Japanese, but also with technically substantial English content—that explore or verify direct manipulation of File Explorer (explorer.exe) windows or “tabs” through Windows messaging (SendMessage, PostMessage).

Articles Testing “Open New Tab” with SendMessage

  • Stack Overflow: “Opening Folder in New Tab of Existing Shell Window” Clearly states that sending the undocumented WM_COMMAND 0xA21B (41499) to ShellTabWindowClass in Windows 11’s Explorer opens a new tab. Provides both a UI Automation approach and an example of SendMessage(hwnd, WM_COMMAND, 0xA21B, 0), complete with technical reasoning and code. (Stack Overflow)

  • NXTED (Japanese): “【C#】Controlling Other Windows” Uses FindWindow("CabinetWClass", …) to get Explorer’s HWND and performs PostMessage(WM_COMMAND, 0x0000A21B, 0) to add a new tab. Demonstrates additional experiments such as focusing the address bar (WM_COMMAND 0x00001006) and enumerating tab headers (ShellTabWindowClass) with embedded code samples. (note)

  • NXTED (Japanese): “【C#】Controlling Other Windows (Preparation)” A prequel to the above, documenting prior research into Explorer class names and message parameters used when adding tabs. The detailed findings are compiled on the company’s blog. (nxted.co.jp)

References Explaining or Applying “Sending Commands to Explorer via SendMessage”

  • NirSoft “GUIPropView” Help A command-line tool for sending operations to any window. Includes an example: /Action SendCommand 28751 Class:CabinetWClass Child.Class:ShellTabWindowClass which switches Explorer to Large Icons view. This is a real-world example of sending WM_COMMAND messages to a child window (ShellTabWindowClass). (NirSoft)

  • (Older but insightful) petitmonte BBS: “How to Hide the Explorer Toolbar?” Discussion from the Windows XP era showing how to target CabinetWClass with commands like SendMessage(WM_COMMAND, 0xA204, …) to manipulate toolbar items. Also covers identifying command IDs using Spy++. Serves as a historical reference on sending WM_COMMAND to Explorer. (petitmonte.com)

AutoHotkey Community Knowledge on “Tab Operations” (Including SendMessage Examples)

  • “Working with Explorer Tabs” (AutoHotkey Forum) A shared set of functions for enumerating and activating Windows 11 Explorer tabs, using a mix of SendMessage, UIA, and COM. Discusses tab-level handle manipulation strategies. (autohotkey.com)

  • “Activating a File Explorer Tab in Windows 11” (AutoHotkey Forum) Trial-and-error discussion on how to activate a specific tab. Notes that WinActivate only affects the current tab, prompting exploration of message-based targeting via tab HWNDs. (autohotkey.com)

  • Reddit: “Force Windows 11 to Open File Explorer in New Tab” Shares an AutoHotkey script that forces new Explorer windows to open as new tabs. Some variants send SendMessage(0x0111, 0xA21B, …) to ShellTabWindowClass. (Reddit)

Background References

  • Official WM_COMMAND Documentation (Microsoft Learn) Explains the meaning of wParam/lParam and the structure for menus, accelerators, and control notifications. Since Explorer’s command IDs are partially undocumented, this helps interpret technical findings. (Microsoft Learn)

  • Official SendMessageW Documentation (Microsoft Learn) Covers process boundaries and UIPI restrictions when sending messages across processes. Because Explorer runs as a separate standard-rights process, messages from an admin process can be blocked by UIPI. (Microsoft Learn)

Quick Reference Notes

  • Target Window Classes The main window is CabinetWClass; tab-related elements are under ShellTabWindowClass. Some examples send WM_COMMAND to the parent (CabinetWClass), others to the child (ShellTabWindowClass). (note)

  • Key Verified Commands (Windows 11 22H2+)

    • 0xA21B (41499) — “New Tab” (undocumented, may change in future). Usually sent to ShellTabWindowClass, though some reports succeed when sent to the parent. (Stack Overflow)
    • 0x1006 — Focus address bar (observed in experiments). (note)
    • 28751 — Switch to “Large Icons” view (from GUIPropView). (NirSoft)

⚠️ Undocumented Command IDs These IDs are not officially supported and may change with Windows updates. Behavior can vary by build or locale. Safest practice: use tools like Spy++, Inspect, or Accessibility Insights to verify IDs locally before relying on them. (Stack Overflow)

Alternative / Complementary Approaches for Robust Tab Handling

  • UI Automation (UIA) Invokes the “+ (New Tab)” button with AutomationId = AddButton. More resistant to language or build differences. Example UIA code and investigation steps are shown in the Stack Overflow thread. (Stack Overflow)

  • COM Interfaces: IShellWindows, IWebBrowserApp, Navigate2 Once a tab is opened, it appears as a window from the COM perspective. Using COM to catch and navigate the target view is a more stable, long-term method. (Stack Overflow)

Recommended Use Strategy

  • For quick experiments → Try WM_COMMAND 0xA21B as shown in the articles (at your own risk). (Stack Overflow)
  • For future-proof solutions → Prefer UI Automation for tab creation and COM (IShellWindows) for navigation; use SendMessage as a supplementary technique. (Stack Overflow)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment