AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

problem mit handle

Ein Thema von delphi_newbie_123 · begonnen am 7. Dez 2004 · letzter Beitrag vom 7. Dez 2004
 
Benutzerbild von Sprint
Sprint

Registriert seit: 18. Aug 2004
Ort: Edewecht
712 Beiträge
 
Delphi 5 Professional
 
#3

Re: problem mit handle

  Alt 7. Dez 2004, 12:55
Zitat von delphi_newbie_123:
nun will ich den handle dieses einen fensters rausbekommen, das man ausgewählt hat.
Warum speicherst du das Handle nicht gleich mit?

Ein Beispiel: Zwei Buttons und eine ComboBox

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);

  function EnumWindowsProc(hWnd: HWND; lParam: LPARAM): BOOL; stdcall;
  begin
    TList(lParam).Add(Pointer(hWnd));
    Result := True;
  end;

var
  List: TList;
  S: String;
  I: Integer;
begin
  ComboBox1.Clear;
  List := TList.Create;
  try
    if EnumWindows(@EnumWindowsProc, Longint(List)) then
    begin
      for I := 0 to List.Count - 1 do
      begin
        if IsWindowVisible(Longint(List.Items[I])) then
        begin
          SetLength(S, GetWindowTextLength(Longint(List.Items[I])) + 1);
          SetLength(S, GetWindowText(Longint(List.Items[I]), PChar(S), Length(S)));
          ComboBox1.Items.AddObject(S, List.Items[I]);
        end;
      end;
    end;
  finally
    List.Free;
  end;
end;
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
begin
  SetForegroundWindow(Longint(ComboBox1.Items.Objects[ComboBox1.ItemIndex]));
end;
Ciao, Sprint.

"I don't know what I am doing, but I am sure I am having fun!"
  Mit Zitat antworten Zitat
 


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 01:53 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz