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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:34:10+00:00 2026-06-04T18:34:10+00:00

I need to be able to list all active applications on a windows machine.

  • 0

I need to be able to list all active applications on a windows machine.
I had been using this code…

  Process[] procs = Process.GetProcesses(".");
  foreach (Process proc in procs)
  {
      if (proc.MainWindowTitle.Length > 0)
      {
          toolStripComboBox_StartSharingProcessWindow.Items.Add(proc.MainWindowTitle);
      }
  }

until I realized that this doesn’t list cases like WORD or ACROREAD when multiple files are opened each in their own window. In that situation, only the topmost window is listed using the above technique. I assume that’s because there’s only one process even though two (or more) files are opened. So, I guess my question is: How do I list all windows rather than their underlying process?

  • 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-06-04T18:34:12+00:00Added an answer on June 4, 2026 at 6:34 pm

    pinvoke using EnumWindows in user32.dll. something like this would do what you want.

    public delegate bool WindowEnumCallback(int hwnd, int lparam);
    
    [DllImport("user32.dll")]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool EnumWindows(WindowEnumCallback lpEnumFunc, int lParam);
    
    [DllImport("user32.dll")]
    public static extern void GetWindowText(int h, StringBuilder s, int nMaxCount);
    
    [DllImport("user32.dll")]
    public static extern bool IsWindowVisible(int h);
    
    private List<string> Windows = new List<string>();
    private bool AddWnd(int hwnd, int lparam)
    {
        if (IsWindowVisible(hwnd))
        {
          StringBuilder sb = new StringBuilder(255);
          GetWindowText(hwnd, sb, sb.Capacity);
          Windows.Add(sb.ToString());          
        }
        return true;
    }
    
    private void Form1_Load(object sender, EventArgs e)
    {
        EnumWindows(new WindowEnumCallback(this.AddWnd), 0);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i used the following code from this tutorial to list all of the
I need to be able to return a list of all children given a
I need to be able to write a list in an URL that is
I need to be able to read a list of variables that follow certain
I need to be able to interrogate a function/method and get a list of
I need to build up a List<object> and cache the list and be able
I'm able to parse through the directory and list all images with any of
I need to be able to have a list of components in a class
I am running on Windows CE and using the Compact Framework. I need to
I've been using Git on both Windows and Ubuntu during the development of a

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.