Click here to Skip to main content
12,507,845 members (54,320 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: MFC
hi everybody
have a good time

i use visual c++ and i want to know how can i get a list that includes names of opened windows in Operating system?
Care that we don't know count of them.

for example:

i open the "Calculator", "Computer", "Personalization", ... windows.
finally i want to give below list with API functions:

Calculator
Computer
Personalization
.
.
.
Posted 23-Dec-12 2:12am
Updated 23-Dec-12 5:21am
CPallini389.6K
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

As Richard already suggested, use EnumWindows function. Then in the callback implementation (see EnumWindowsProc callback function[^] at MSDN), call GetWindowText[^], see this thread[^].
  Permalink  
Comments
Richard MacCutchan 23-Dec-12 11:35am
   
And a 5 for all the extra information.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

The EnumWindows function[^] will get you what you want.
  Permalink  
Comments
CPallini 23-Dec-12 11:20am
   
5.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

this code works:

BOOL EnumWindowsProc(HWND hWnd, long lParam)
{
         char Buff[255], NameOfClass[255];
		 
         GetWindowTextA(hWnd, Buff, 254);           // titlul ferestrei
		 
         GetClassNameA(hWnd, NameOfClass, 254);  // clasa
         //adauga in lista:
         
         return TRUE;
}
 
void CEnumWindowsDlg::OnBnClickedButton1()
{
WNDENUMPROC w;
EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
 

}
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 23 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100