AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Code-Bibliothek Library: Windows API / MS.NET Framework API Delphi Alle Fensterhandle finden anhand der WindowCaption
Thema durchsuchen
Ansicht
Themen-Optionen

Alle Fensterhandle finden anhand der WindowCaption

Ein Thema von idontwantaname · begonnen am 5. Nov 2005
Antwort Antwort
Benutzerbild von idontwantaname
idontwantaname

Registriert seit: 31. Aug 2004
Ort: Traiskirchen
575 Beiträge
 
Turbo Delphi für Win32
 
#1

Alle Fensterhandle finden anhand der WindowCaption

  Alt 5. Nov 2005, 13:05
Hallo !!

Manchmal kommt es vor, dass man Handle mehrerer Fenster braucht, die jedoch alle die selbe WindowCaption haben.
Hierzu hab ich folgende Funktion mit der Hilfe von neolithos (der Thread) geschrieben

Delphi-Quellcode:
type THandleArray = array of HWND;

function FindAllWindows(const WindowCaption: String): THandleArray;
type
  PParam = ^TParam;
  TParam = record
    WindowCaption: String;
    Res: THandleArray;
  end;
var
  Rec: TParam;
  function _EnumProc(_hWnd: HWND; _LParam: LPARAM): LongBool; stdcall;
  var
    cTitle: array[0..1023] of Char;
  begin
    with PParam(_LParam)^ do
    begin
      GetWindowText(_hWnd, cTitle, SizeOf(cTitle));
      if (CompareText(cTitle, WindowCaption) = 0) then
      begin
        SetLength(Res, Length(Res)+1);
        Res[Length(Res)-1] := _hWnd;
      end;
      Result := True;
    end;
  end;
begin
  Rec.WindowCaption := WindowCaption;
  SetLength(Rec.Res, 0);
  EnumWindows(@_EnumProc, Integer(@Rec));
  Result := Rec.Res;
end;
Oliver Hanappi
  Mit Zitat antworten Zitat
Antwort Antwort

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:15 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz