Ok, you want access to the taskbar which is going to have a list of the
current unowned windows. You need to retrieve a pointer to ITaskbarList
which if you search through your registry should supply you with the class
id (CLSID) for this object (Remember the CLSID will probably be different on
each machine so you'll need an elegant way of retrieving this). Use the
function CoCreateInstance to get yourself a handle to this and then call the
method HrInit to initialise it (funny that). Now you are already using
EnumWindows to return yourself a handle to all the currently available
windows. To determine what windows are associated with the taskbar, us the
SetActiveAlt method associated with the ITaskbarList class. Cycle through
each Window handle and pass the handle to the SetActiveAlt method. This
will return NOERROR (0) if successful or an OLE error code if the window is
not associated with the taskbar. Call SetActiveAlt passing null as the
parameter to negate the previous operation. Now you have a list of window
handles which reside on the taskbar (or conversly a list of window handles
which aren't associated with the taskbar). That's my two cents worth anyway
and I am sure someone will refine or provide a better answer :-)
Tony Sinclair
Holliday Group Limited
Christchurch
New Zealand
> -----Original Message-----
> From: Matt Powell [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, February 23, 2000 10:42 PM
> To: Multiple recipients of list delphi
> Subject: [DUG]: Fried Brain
>
> I have a small but annoying problem. I'm trying to write one of those apps
> that provides "Virtual Desktops" [1]. I'm at the stage where I know what
> to
> do (maintain a list of windows that are visible on each desktop, and
> show/hide the relevant ones when the user switches) but I'm not sure of
> the
> picky details. At the moment I'm using EnumWindows to get a list of the
> current windows, but this is giving me more windows than I need -
> including
> Progman and some unnamed windows.
>
> What I need is some way of telling which windows are currently visible in
> the taskbar, which seems to be how other similar apps do it. That way I
> can
> enumerate their child windows and popups so I don't miss anything, but I
> won't be bothered with unnecessary "windows" that don't need to be (and
> thus
> shouldn't be) shown/hidden. Alternatively, some way of telling whether a
> window handle represents an actual visible form would be nice (that way I
> can get things like ICQ and WinAmp which hide themselves from the taskbar,
> which CoolDesk doesn't seem to worry about).
>
> Does anybody have any ideas on where to go from here? It seems like a fun
> project, but I'm getting frustrated with the implementation details of
> what
> seems to be a simple idea. (On a related matter, does anybody know how to
> get the system menu icon for a window from its window handle? Or do you
> have
> to go through ExtractIcon?)
>
> I'd offer a free copy of my app to anybody who can help me out, but it'll
> be
> freeware anyway :) Rest assured you'll get all the fame I can give you,
> even
> if not the fortune...
>
> TIA
>
> - Matt
>
> [1] My current one is unlicensed 30-day shareware, and I'm too cheap to
> register it.
>
> --------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz