Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Nov : Hide all open windows

www.cryer.info
Managed Newsgroup Archive

Hide all open windows

Subject:Hide all open windows
Posted by:"Andrew Jameson" (softspotsoftwareno@spamgmail.com)
Date:Wed, 1 Nov 2006 15:34:52

Hi,
I need to hide all open application when it starts ... so I enumerate all
windows into a TList and then use SW_HIDE or SW_SHOW in a
Begin/EndDeferWindowPos loop.  I use the following callback :

function EnumWindowsProc(Wnd : HWND; WndList : TList) : Bool; stdcall;
var
  WndClassName  : array[0..255] of char;
begin
  Result  := true;
  if IsWindowVisible(Wnd) and
       (Wnd <> FindWindow('Shell_TrayWnd', nil)) and
         (Wnd <> FindWindow('Progman', nil)) then begin
    GetClassName(Wnd, WndClassName, 255);
    if (WndClassName <> 'tooltips_class32') and
         (WndClassName <> 'SysShadow') then
      WndList.Add(Pointer(Wnd));
  end; {if}
end;

I recently came across a problem with XP shadows ... if a drop down or
context menu is visible then when I did a restore I found that the screen
was corrupted by the residual shadow from the menu.  During the enumeration
I'd collected a classname SysShadow, so I added it to the above to exclude
it.  The problem then is that the menu shadow persists when my application
runs and that the shadow is only cleared when I close the application
associated with the original menu.

Any ideas ?

Thanks

Andrew

Replies:

www.cryer.info
Managed Newsgroup Archive