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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:04:42+00:00 2026-05-22T22:04:42+00:00

Using pinvoke I can find Handle of a window with particular class & name

  • 0

Using pinvoke I can find Handle of a window with particular class & name easily:

[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
IntPtr hWnd = FindWindow("Foo Class", "Foo Window");

The above code works perfect if there is only 0 or 1 matching windows. However the unmanaged application I am working with spans multiple windows. Calling FindWindow multiple times returns the same Window Handle each time.

What do I need to do to get ALL windows with particular class and name.

I will also accept answer for alternate solution the same goal. (I am thinking maybe it can be done by finding process ID of application and then getting all top level windows, and filtering for the ones needed).

  • 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-22T22:04:43+00:00Added an answer on May 22, 2026 at 10:04 pm

    You probably need to call EnumWindows to enumerate ALL top-level windows. You’ll have to use their window handles to get their titles and window class information.

    See http://www.pinvoke.net/default.aspx/user32/enumwindows.html for an example that does very close to what you’re asking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What exceptions can occur when using PInvoke or are all errors handled by the
I am trying to use the function PathCanonicalize using DllImport (PInvoke) on a 64
I am having an interesting problem with using pinvoke in C# to call _snwprintf.
Is there a managed API for kernel32.searchpath? i.e not using a pinvoke. http://www.pinvoke.net/default.aspx/kernel32.searchpath
I am (successfully) calling the Windows FilterSendMessage function in c# using the following pinvoke
I want to use System.Numerics.Complex in an unmanaged PInvoke scenario. Using ILSpy, I noticed
I'm calling a non-.NET dll from my project using P/Invoke, meaning that the .dll
Using PyObjC , you can use Python to write Cocoa applications for OS X.
I'm using .NET 4 and the new RegistryKey.FromHandle call so I can take the
Created basic C++ DLL and exported names using Module Definition file (MyDLL.def). After compilation

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.