How to get All HWNDS

Posted on 2005-04-01
Medium Priority
Last Modified: 2013-11-20
Hi All

I want to get the List of all HWNDS that are opened or executing in hidden mode based on the Title what I give

For example if the Title contains "Microsoft" I want to get all windows based on that title

I know that FindWindow can be used to fetch only one widow.


Question by:sudhakar_koundinya
  • 2
LVL 16

Expert Comment

ID: 13680524
You can use EnumWindows to enumerate all the windows and then you can match their name against "Microsoft" in your EnumWndProc
LVL 16

Accepted Solution

nonubik earned 500 total points
ID: 13680558
BOOL CALLBACK MyEnumWindowsProc(  HWND hwnd,   LPARAM lParam)
  char szText[MAX_PATH];
  GetWindowText(hwnd, szText, MAX_PATH);
  if(strstr(szText, "Microsoft"))

And call EnumWindows(MyEnumWindowsProc, 0);

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question