?
Solved

Detecting all hidden windows

Posted on 2009-04-29
3
Medium Priority
?
961 Views
Last Modified: 2012-05-06
How do I get a list of all the "hidden" windows. That is all the windows that were showed with ShowWindow using the SW_HIDE parameter. I know that one can use EnumWindows but I would appreciate some help with this.
0
Comment
Question by:skynergy
3 Comments
 
LVL 1

Accepted Solution

by:
KillerCode earned 200 total points
ID: 24388928
i know its too late to answer, but ive nothing else to do and im new here

How-To
 Memo1.Text := ListWindows(1); //Include Inivisble
 Memo1.Text := ListWindows(0); //Don't Include Inivisble

PS : WindowList MUST be a global Variable (Before "Implementation")
var
 WindowList:String;
 
function GetWindowState(Handle: HWND):String;
begin
  If IsWindowVisible(Handle) Then Result := 'Visible'
  Else Result := 'Invisible';
end;
 
function ListWindows(INV:Integer):String;
 
  function EnumWindowProc(Hwnd: HWND; i: integer): boolean; stdcall;
  var
   Titulo : string;
  begin
   if Hwnd <> 0 then
   begin
    SetLength(Titulo, 255);
    SetLength(Titulo, GetWindowText(Hwnd, PChar(Titulo), Length(Titulo)));
    if i = 1 Then if (Titulo<>'') then WindowList := WindowList + GetWindowState(Hwnd) + #9 + Titulo + #9 + IntToStr(Hwnd) + #13#10;
    if I = 0 Then if (IsWindowVisible(Hwnd)) and (Titulo <> '') then WindowList := WindowList + #9 + Titulo + #9 + IntToStr(Hwnd) + #13#10;
   end;
  Result := true;
  end;
begin
 WindowList := '';
 EnumWindows(@EnumWindowProc, Inv);
 Result := WindowList;
end;

Open in new window

0
 

Author Closing Comment

by:skynergy
ID: 31576170
Thank you for this. It was exactly what I needed!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Screencast - Getting to Know the Pipeline

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question