線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1021
推到 Plurk!
推到 Facebook!

刪除任務欄(Task bar)無用的Icon

 
mathewzhao
中階會員


發表:121
回覆:164
積分:67
註冊:2003-04-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-04-12 15:06:38 IP:61.150.xxx.xxx 未訂閱
刪除任務欄(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
系統時間:2024-07-04 19:09:20
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!