How to get window list
-
Hello all I want to develop one application in which i want to know the list of all open window either it is minimized Is this possible to know?? If possible then provide some code Snippets. Thanks in advance.
Manish Patel. B.E. - Information Technology.
-
Hello all I want to develop one application in which i want to know the list of all open window either it is minimized Is this possible to know?? If possible then provide some code Snippets. Thanks in advance.
Manish Patel. B.E. - Information Technology.
manish.patel wrote:
If possible then provide some code Snippets.
I refuse your demand! I will however point you in the right direction... (OK, *a* direction). A B.E. in information technology can surely read documentation for the details. You can use
GetDesktopWindow
to get the, um, desktop window. Then eitherGetWindow
with parametersGW_CHILD
orGW_NEXT
. You can check with functions such as IsWindowVisible etc to filter out various states. Alternately, you could useEnumChildWindows
to do some of the work for you, at the expense of writing a second function. Iain.CPallini no longer cares if Iain Clarke appears or not. /sad
-
manish.patel wrote:
If possible then provide some code Snippets.
I refuse your demand! I will however point you in the right direction... (OK, *a* direction). A B.E. in information technology can surely read documentation for the details. You can use
GetDesktopWindow
to get the, um, desktop window. Then eitherGetWindow
with parametersGW_CHILD
orGW_NEXT
. You can check with functions such as IsWindowVisible etc to filter out various states. Alternately, you could useEnumChildWindows
to do some of the work for you, at the expense of writing a second function. Iain.CPallini no longer cares if Iain Clarke appears or not. /sad
Iain Clarke wrote:
CPallini no longer cares if Iain Clarke appears or not. /sad
Who did tell you it? He cares for sure. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Iain Clarke wrote:
CPallini no longer cares if Iain Clarke appears or not. /sad
Who did tell you it? He cares for sure. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeWell, I had by "special request", then "in spite of being asked not to", so it seemed about time for a different variation! Iain.
Iain Clarke appears because CPallini still cares.
-
Hello all I want to develop one application in which i want to know the list of all open window either it is minimized Is this possible to know?? If possible then provide some code Snippets. Thanks in advance.
Manish Patel. B.E. - Information Technology.
Here's a start:
// VanillaConsole.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <malloc.h>
#include <iostream>
using namespace std;
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
int len = GetWindowTextLength(hWnd);
if (len == 0 )
{
return true;
}
LPTSTR pText = static_cast<LPTSTR>(_alloca((len+1)*sizeof(TCHAR)));
GetWindowText(hWnd, pText, len+1);
cout << pText << endl;
return true;
}
int main()
{
EnumWindows(&EnumWindowsProc, 0);
return 0;
}Steve
-
Here's a start:
// VanillaConsole.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <malloc.h>
#include <iostream>
using namespace std;
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
int len = GetWindowTextLength(hWnd);
if (len == 0 )
{
return true;
}
LPTSTR pText = static_cast<LPTSTR>(_alloca((len+1)*sizeof(TCHAR)));
GetWindowText(hWnd, pText, len+1);
cout << pText << endl;
return true;
}
int main()
{
EnumWindows(&EnumWindowsProc, 0);
return 0;
}Steve
Hey Steve Thanks for your kind reply and providing code for me.. Again Thanks bye..
Manish Patel. B.E. - Information Technology.
-
Hello all I want to develop one application in which i want to know the list of all open window either it is minimized Is this possible to know?? If possible then provide some code Snippets. Thanks in advance.
Manish Patel. B.E. - Information Technology.
try FindWindow and FindWindowEx combination [][^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/codeProject$$>