Thema: Delphi Alt + Tab

Einzelnen Beitrag anzeigen

Benutzerbild von Evian
Evian

Registriert seit: 10. Apr 2003
Ort: Berlin
485 Beiträge
 
Delphi 6 Professional
 
#6

Re: Alt + Tab

  Alt 5. Apr 2004, 17:21
Jup, so in etwa habe ich es dann in etwa gemacht:

Code:

function EnumWindowsProc (Wnd: HWND; LParam: LPARAM): BOOL; stdcall;
var Bezeichnung : Array[0..200] of Char;
begin
  if (IsWindowVisible(Wnd) or IsIconic(wnd)) and
     ((GetWindowLong(Wnd, GWL_HWNDPARENT) = 0) or
     (GetWindowLong(Wnd, GWL_HWNDPARENT) = GetDesktopWindow)) and
     (GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOOLWINDOW = 0) then begin
      GetWindowText(Wnd, Bezeichnung, 256);
      Form1.Listbox1.Items.Append(Bezeichnung);
  end;
end;

procedure Refresh;
begin
  Listbox1.Clear;
  EnumWindows(@EnumWindowsProc, 1);
end;

procedure TForm1.Button1Click(Sender: TObject);
VAR
hWnd: DWORD;
begin
  Refresh;
  IF index < Listbox1.Count - 1 THEN
  inc(index) ELSE
  index := 0;
  hWnd := FindWindow(nil, PChar(Listbox1.Items[index]));
  if hWnd <> 0 then
  SetForeGroundWindow(hWnd);
end;
-> www.Phillsoft.de

Ich bin nun Mathematiker, aber meine Freundin bleibt trotzdem unberechenbar!
  Mit Zitat antworten Zitat