![]() |
Taskbar Programm-Einträge auslesen
Hallo Leute,
mal ne kurze Frage: Wie kann ich "nur diejenigen Anwendungen", die in der Taskbar dargestellt werden (Word, Excel,Outlook.. OHNE TrayiconApps) auslesen (Handle parent = Taskbar?) - die "normale" Handle Liste beinhaltet ja "alles" via FindWindowEx(FindWindow('Shell_TrayWnd .. hab ich ja ein Handle auf die taskbar... Vielen Dank Erich |
AW: Taskbar Programm-Einträge auslesen
Hi,
hier gibts bischen source dazu: ![]() oder du nimmst die TWindowList, das funzt auch sehr gut, das gibts hier ganz unten: ![]() gruß tom |
AW: Taskbar Programm-Einträge auslesen
Ich selbst habs mal wo mit twindowlist gemacht, ein popupmenü mit dem ich die items die in der taskleiste sind anzeige...
Delphi-Quellcode:
procedure TMainform.GetTasks; label nxt; var win1:TWindowList; tx1,tx2:Integer; upd1:Boolean; ts1,hwnd1, old_map: TStringList; PrgIcon : HIcon; XIcon : TIcon; IcOBMP, EcoBMP : TBitmap; NewMenuItem : TMenuitem; function sendmsg(Handle : HWND; Msg : Cardinal; wParam, lParam : Integer):Cardinal; begin SendMessageTimeout(Handle,Msg,wParam,lParam, SMTO_ABORTIFHUNG, 500, Result); end; begin win1:=TWindowList.Create(self); ts1:=TStringList.Create; hwnd1:=TStringList.Create; old_map := TStringList.Create; try upd1:=false; for tx1:=0 to win1.Count-1 do begin if win1.Windows[tx1].IsVisible and win1.Windows[tx1].IsEnabled and IsMainAppWindow(win1.Windows[tx1].WinHandle) then begin hwnd1.Add(Inttostr(win1.Windows[tx1].WinHandle)); ts1.Add(win1.Windows[tx1].WinCaption); end; end; if hwnd1.Count = 0 then begin win1.Free; ts1.free; hwnd1.Free; old_map.Free; Exit; end; for tx1:=0 to hwnd1.Count-1 do begin if old_map.IndexOf(hwnd1.Strings[tx1])=-1 then begin old_map.Clear; for tx2:=0 to hwnd1.Count -1 do old_map.Add(hwnd1.Strings[tx2]); upd1:=true; goto nxt; end; end; for tx1:=0 to old_map.Count-1 do begin if hwnd1.IndexOf(old_map.Strings[tx1])=-1 then begin old_map.Clear; for tx2:=0 to hwnd1.Count -1 do old_map.Add(hwnd1.Strings[tx2]); upd1:=true; goto nxt; end; end; for tx1:=0 to hwnd1.Count-1 do begin if not(hwnd1.Strings[tx1]=old_map.Strings[tx1]) then begin old_map.Clear; for tx2:=0 to hwnd1.Count -1 do old_map.Add(hwnd1.Strings[tx2]); upd1:=true; goto nxt; end; end; nxt:if upd1 then begin TasksMenu.Items.Clear; for tx1 := 0 to ts1.Count - 1 do begin NewMenuItem := TMenuitem.Create(TasksMenu); NewMenuItem.Caption := ts1.Strings[tx1]; NewMenuItem.Tag := tx1; NewMenuItem.Hint := hwnd1.Strings[tx1]; NewMenuItem.OnClick := TaskItemClick; NewMenuItem.Visible := True; NewMenuItem.ImageIndex := 25; XIcon := TIcon.Create; IcOBMP := TBitmap.Create; EcoBMP := TBitmap.Create; try PrgIcon := sendmsg(StrToInt(hwnd1.Strings[tx1]), WM_GETICON, ICON_SMALL2, 0); if PrgIcon = 0 then PrgIcon := sendmsg(StrToInt(hwnd1.Strings[tx1]), WM_GETICON, ICON_SMALL, 0); if PrgIcon <> 0 then begin XIcon.Handle := PrgIcon; IcOBMP.Width:= XIcon.Width; IcOBMP.Height:= XIcon.Height; IcOBMP.Canvas.Draw(0, 0, XIcon); EcoBMP.Height := 32; EcoBMP.Width := 32; EcoBMP.Canvas.StretchDraw(Rect(0,0,32,32),IcoBMP); EcoBMP.Height := 16; EcoBMP.Width := 16; try NewMenuItem.Bitmap := EcOBMP; except end; end; NewMenuItem.ImageIndex := -1; finally XIcon.Free; IcOBMP.Free; EcoBMP.Free; end; TasksMenu.Items.Add(NewMenuItem); end; end; finally win1.Free; ts1.free; hwnd1.Free; old_map.Free; end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:59 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