Number of top level windows open
-
Does anyone know how to find the number of windows open at a given time? I've looked into enumwindows and the find/get window functions, but there must be a way to just ask the window manager for this piece of information without having to iterate through all the windows. Thanks, ~Himanshu
-
Does anyone know how to find the number of windows open at a given time? I've looked into enumwindows and the find/get window functions, but there must be a way to just ask the window manager for this piece of information without having to iterate through all the windows. Thanks, ~Himanshu
What's wrong with:
BOOL CALLBACK EnumProc( HWND hwnd, LPARAM lParam )
{
PUINT puCount = (PUINT) lParam;(\*puCount)++; return TRUE;
}
UINT uCount = 0;
EnumWindows(EnumProc, (LPARAM) &uCount);
TRACE(_T("The numer of top-level windows is: %u\n"), uCount);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
What's wrong with:
BOOL CALLBACK EnumProc( HWND hwnd, LPARAM lParam )
{
PUINT puCount = (PUINT) lParam;(\*puCount)++; return TRUE;
}
UINT uCount = 0;
EnumWindows(EnumProc, (LPARAM) &uCount);
TRACE(_T("The numer of top-level windows is: %u\n"), uCount);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
I don't think there is a way to just get the count aside from the enumeration API. However, you must make one distinction. Do you want: a) ALL windows on the system? b) ALL _VISIBLE_ windows on the system (There are a lot of windows on the system that are not visible)? c) ALL _TOP LEVEL_ windows on the system? There is also the question of do you want to include each little component such as each button, edit box, system tray, the desktop icons (progman), the task bar, etc. etc. etc. because all those little details get enumerated. All controls, etc. Depending on what you are looking for would determine how you write the counting code to exclude and include the correct windows when you enumerate. There is also "EnumChildWindows" which may need to be called on each top level enumerated window if you don't want just top level windows. 8bc7c0ec02c0e404c0cc0680f7018827ebee
-
I don't think there is a way to just get the count aside from the enumeration API. However, you must make one distinction. Do you want: a) ALL windows on the system? b) ALL _VISIBLE_ windows on the system (There are a lot of windows on the system that are not visible)? c) ALL _TOP LEVEL_ windows on the system? There is also the question of do you want to include each little component such as each button, edit box, system tray, the desktop icons (progman), the task bar, etc. etc. etc. because all those little details get enumerated. All controls, etc. Depending on what you are looking for would determine how you write the counting code to exclude and include the correct windows when you enumerate. There is also "EnumChildWindows" which may need to be called on each top level enumerated window if you don't want just top level windows. 8bc7c0ec02c0e404c0cc0680f7018827ebee
Toby Opferman wrote: c) ALL _TOP LEVEL_ windows on the system? "Top level windows" were specifically asked for in the subject.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
Toby Opferman wrote: c) ALL _TOP LEVEL_ windows on the system? "Top level windows" were specifically asked for in the subject.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
Ok, He'll need to filter out the invisible windows, task bar, prog man and the system tray. 8bc7c0ec02c0e404c0cc0680f7018827ebee
-
Ok, He'll need to filter out the invisible windows, task bar, prog man and the system tray. 8bc7c0ec02c0e404c0cc0680f7018827ebee
That's if he doesn't want those, he needs to figure out if he really does want all the top level windows or only ones seen by the task bar (which then he would need to fitler things like side tool bars), etc. 8bc7c0ec02c0e404c0cc0680f7018827ebee