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 458609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:41:19+00:00 2026-05-12T22:41:19+00:00

How can we get the handle of a window that doesn’t have a title?

  • 0

How can we get the handle of a window that doesn’t have a title? Is there a way to enumerate all the windows on desktop and filter the window that don’t have a title (in my case, there is only one) and getting the handle of it.. or by specifying other attributes like a window that has a specific button or listbox etc…

  • 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-12T22:41:20+00:00Added an answer on May 12, 2026 at 10:41 pm

    This should do it:

        ...
        using System.Runtime.InteropServices;
        using System.Diagnostics;
    
        ...
    
    public class foo()
    {
        ...
    
        [DllImport ("user32")]
        internal static extern int GetWindowText (int hWnd, String text, int nMaxCount);
    
        [DllImport ("user32.dll")]
        public static extern int GetWindowTextLength (int hWnd);
    
        [DllImport ("user32.dll")]
        public static extern int FindWindow (String text, String class_name);
    
        [DllImport ("user32.dll")]
        public static extern int FindWindowEx (int parent, int start, String class_name);
    
        [DllImport ("user32.dll")]
        public static extern int GetWindow (int parent, uint cmd);
    
        public List<int> FindTitlelessWindows()
        {
            List<int> titleless = new List<int> ();
    
            Process [] procs = Process.GetProcesses ();
            IntPtr hWnd;
    
            foreach (Process proc in procs)
            {
                hWnd = proc.MainWindowHandle;
                if (hWnd != IntPtr.Zero)
                {
                    TraverseHierarchy (hWnd.ToInt32 (), 0, titleless);
    
                }
            }
    
            foreach (int i in titleless)
            {
                System.Console.WriteLine (i);
            }
    
            return titleless;
        }
    
        public void TraverseHierarchy (int parent, int child, List<int> titleless)
        {
            String text = "";
            GetWindowText (parent, text, GetWindowTextLength (parent));
            if (String.IsNullOrEmpty (text))
            {
                titleless.Add (parent);
            }
    
            TraverseChildern (parent, titleless);
            TraversePeers (parent, child, titleless);
    
        }
    
        public void TraverseChildern(int handle, List<int> titleless)
        {
            // First traverse child windows
            const uint GW_CHILD = 0x05;
            int child = GetWindow (handle, GW_CHILD);
            if (0 != child)
            {
                TraverseHierarchy (child, 0, titleless);
    
            }
        }
    
        public void TraversePeers(int parent, int start, List<int> titleless)
        {
            // Next traverse peers
            int peer = FindWindowEx(parent, start, "");
            if (0 != peer)
            {
                TraverseHierarchy (parent, peer, titleless);
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Watir you can get WIN32OLE handle of IE window using next method. irb(main):059:0>
I know that I can get a POSIX int file handle from NSURL by
Is there a generic API call I can make to get a handle of
Logging can get complicated, quickly. Considering that you have some code, how do you
Is there any way to get NaN s from the Windows CRT string to
How can we get and handle the sftp return codes in a C program
Can get all triples with value null in specific field? All people with date_of_birth
I have a WPF window that has TopMost=true . When I call another Window
What is the recommended way to get a handle to the global object in
I am writing a program on Windows XP, trying to get the proccess handle

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.