starting Terminal with wt no longer returns the main window handle of the resulting window #9864

Open
opened 2026-01-31 02:05:56 +00:00 by claunia · 0 comments
Owner

Originally created by @torchgm on GitHub (Jul 27, 2020).

Environment

Windows build number: 10.0.20175.0
Windows Terminal version (if applicable): 1.2.2022

Any other software?
N/A

Steps to reproduce

Open Windows Terminal 1.2.2022 from code that supports returning the main window handle; for example in C# .NET

using System;
using System.Diagnostics;
using System.Threading;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Process p = Process.Start("wt"); // Start Windows Terminal
            Thread.Sleep(1000); // Wait a second to make sure it's open
            Console.WriteLine(p.MainWindowHandle.ToString()); // Print handle to console
            Console.ReadLine(); // Wait for user input before finishing
        }
    }
}

Expected behavior

The handle for the subsequently opened window is returned. In the example above, a numerical value representing the window handle is printed to the console (such as 856282)

Actual behavior

A handle of 0 is returned.

Originally created by @torchgm on GitHub (Jul 27, 2020). # Environment ```none Windows build number: 10.0.20175.0 Windows Terminal version (if applicable): 1.2.2022 Any other software? N/A ``` # Steps to reproduce Open Windows Terminal 1.2.2022 from code that supports returning the main window handle; for example in C# .NET ```csharp using System; using System.Diagnostics; using System.Threading; namespace Test { class Program { static void Main(string[] args) { Process p = Process.Start("wt"); // Start Windows Terminal Thread.Sleep(1000); // Wait a second to make sure it's open Console.WriteLine(p.MainWindowHandle.ToString()); // Print handle to console Console.ReadLine(); // Wait for user input before finishing } } } ``` # Expected behavior The handle for the subsequently opened window is returned. In the example above, a numerical value representing the window handle is printed to the console (such as `856282`) # Actual behavior A handle of `0` is returned.
claunia added the Resolution-By-DesignNeeds-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 02:05:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9864