|
-
November 2nd, 2000, 10:05 AM
#1
EnumWindows enumerates too much windows !
Hi everybody,
A new problem for me : I would like to enumerate the current running windows in my computer. I use the EnumWindows function to do it. EnumWindows does enumerate too much windows for me and I would like it to give me only the opened and visible windows.
If you run the Spy++ program, you'll get all the windows (the visible and the hidden one) in it. It's too much in my case. I just want the one which appears in the task bar.
Thanks a lot...
-
November 2nd, 2000, 10:17 AM
#2
Re: EnumWindows enumerates too much windows !
Hi,
Use thisvoid EnumApp()
{
HWND hWnd, hWndNext;
char szWindowName[1024];
hWnd = ::GetDesktopWindow();
if (hWnd != NULL)
{
hWndNext = ::GetTopWindow(hWnd);
while (hWndNext != NULL)
{
::GetWindowText(hWndNext, szWindowName, sizeof(szWindowName));
if ((strlen(szWindowName) > 0) && (::IsWindowVisible(hWndNext)))
TRACE("visible windows %s\n", szWindowName);
hWndNext = ::GetNextWindow(hWndNext, GW_HWNDNEXT);
}
}
}
Tell me if that help.
Regards,
Emi.
Regards,
Emanuel Vaduva
-
November 2nd, 2000, 10:20 AM
#3
Re: EnumWindows enumerates too much windows !
You could use the window handle returned from EnumWindows to call GetWindowInfo. Check the window style against what you are looking for, and ignore any window that doesn't meet your criteria.
-
November 3rd, 2000, 12:05 PM
#4
Re: EnumWindows enumerates too much windows !
OK, thanks for your help.
Here is the solution I've kept to resolve my problem :
CWnd* pParentWindow = GetParent();
CWnd* pNextWindow = pParentWindow->GetWindow(GW_HWNDNEXT);
while(pNextWindow)
{
if((!pNextWindow->IsIconic()) && (pNextWindow->IsWindowVisible())
// OK, the window can overlap my draw area, I have to do GetWindowRect to control the
// coords of both draw area and window found
pNextWindow = pNextWindow->GetWindow(GW_HWNDNEXT);
}
In parallel to that solution, I've found another way to be sure that no window overlaps my draw area.
I just test if the active window is the draw area parent window. If it's not the case, I know that my
draw area can be overlapped. If it's the case, may be my draw area is completely visible and not
overlapped.
However, I have to verify that my own parent window doesn't overlap my draw area.
OK, thanks a lot again for your precious help...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|