刪除任務欄(Task bar)無用的Icon |
|
mathewzhao
中階會員 發表:121 回覆:164 積分:67 註冊:2003-04-04 發送簡訊給我 |
刪除任務欄(Task bar)無用的Icon
作者:Erik Turner
procedure RemoveDeadIcons; var TrayWindow : HWnd; WindowRect : TRect; SmallIconWidth : Integer; SmallIconHeight : Integer; CursorPos : TPoint; Row : Integer; Col : Integer; begin { Get tray window handle and bounding rectangle } TrayWindow := FindWindowEx(FindWindow('Shell_TrayWnd',NIL),0,'TrayNotifyWnd',NIL); if not GetWindowRect(TrayWindow,WindowRect) then Exit; { Get small icon metrics } SmallIconWidth := GetSystemMetrics(SM_CXSMICON); SmallIconHeight := GetSystemMetrics(SM_CYSMICON); { Save current mouse position } GetCursorPos(CursorPos); { Sweep the mouse cursor over each icon in the tray in both dimensions } with WindowRect do begin for Row := 0 to (Bottom - Top) DIV SmallIconHeight do begin for Col := 0 to (Right - Left) DIV SmallIconWidth do begin SetCursorPos(Left Col * SmallIconWidth, Top Row * SmallIconHeight); Sleep(0); end; end; end; { Restore mouse position } SetCursorPos(CursorPos.X,CursorPos.Y); { Redraw tray window (to fix bug in multi-line tray area) } RedrawWindow(TrayWindow,NIL,0,RDW_INVALIDATE OR RDW_ERASE OR RDW_UPDATENOW); end;發表人 - mathewzhao 於 2004/04/12 15:08:09 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |