Autor Beitrag
seddto
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: So 04.04.04 17:06 
Hallo,

Ich möchte gerne einfach nur zählen wieviel Windows Fenster gerade geöffnet sind um das mit einem Vergleichswert zu vergleichen. Kann mir jemand sagen wie das geht?

Danke & LG Seddto
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 04.04.04 17:12 
Hi,

Folgender Code zählt alle Fenster, welche einen Button in der Taskleiste haben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
var
 WinCount: Integer = 0;

function EnumWindowsProc(Wnd: HWND; lParam: lParam): BOOL; stdcall;
begin
  Result := True;
  if (IsWindowVisible(Wnd) or IsIconic(wnd)) and
    ((GetWindowLong(Wnd, GWL_HWNDPARENT) = 0or
    (GetWindowLong(Wnd, GWL_HWNDPARENT) = GetDesktopWindow)) and
    (GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOOLWINDOW = 0then
     Inc(WinCount);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  Param: Longint; 
begin
  EnumWindows(@EnumWindowsProc, Param);
  ShowMessage(Inttostr(WinCount));
end;
seddto Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: So 04.04.04 17:27 
Danke für die schnelle Antwort. Gibt es denn auch noch eine Möglichkeit geöffnete Fenster die nicht in der Taskleiste sind zu finden?
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: So 04.04.04 22:34 
Einfach nur die If-Abfrage rausnehmen und das Inc(WinCount); stehen lassen..! ;)

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!