Home All Groups Group Topic Archive Search About

EnumWindows, how to identify windows

Author
6 Apr 2007 1:19 PM
Zamdrist
I can return a list of windows and their titles using the API,
AddressOf & Callbacks, however I get all programs/processes like GDI+,
DDE Server, etc. I really just want the programs opened in the
taskbar, such as Outlook, Query Analyzer (whatever)...How can I fliter
the list?

I was hoping to use this, but if there is another method I'd like to
know.

Private Declare Function IsWindowVisible Lib "user32" _
(ByVal hwnd As IntPtr) As Long

This returns such things as:

8975933078237085696
8975933078237085697
8975933078237085697
8975933078237085696
8975933078237085696
8975933078237085697

Incidently, the ones ending in 97 are 'user program windows' if you
will. Thanks...

Author
6 Apr 2007 4:47 PM
Mattias Sjögren
>How can I fliter the list?

You can find some details about how the taskbar does its selection
under the Managing Taskbar Buttons section here

http://msdn2.microsoft.com/en-us/library/aa969325.aspx

You basically have to do the same. Look at the window style bits etc.


>I was hoping to use this, but if there is another method I'd like to
>know.
>
>Private Declare Function IsWindowVisible Lib "user32" _
>(ByVal hwnd As IntPtr) As Long
>
>This returns such things as:
>
>8975933078237085696

The return type should be a Boolean, not a Long.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
6 Apr 2007 8:50 PM
Zamdrist
On Apr 6, 10:47 am, Mattias Sjögren <mattias.dont.want.s***@mvps.org>
wrote:
>
> The return type should be a Boolean, not a Long.
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
> Please reply only to the newsgroup.

Thank you Mattias, that was helpful. Changing the function to return
Boolean allowed me to test against it and filter out the unwanted
processes from the user programs.

Steve

AddThis Social Bookmark Button