清理任务栏残留图标Delphi版 附源程序
2006-09-20 11:24
435 查看
//我想任何人都遇到过这样的情况:
//任务栏右下角的快捷图标有时并不会随着程序的关闭而消失
//只有当鼠标划过时才消失
//下面的函数可以通过自动划过并清除这些图标
procedure RemoveDeadIcons;
var
TrayWindow : HWnd;
WindowRect : TRect;
SmallIconWidth : Integer;
SmallIconHeight : Integer;
CursorPos : TPoint;
Row : Integer;
Col : Integer;
begin
{ 获得任务栏句柄和边框}
TrayWindow := FindWindowEx(FindWindow('Shell_TrayWnd',NIL),0,'TrayNotifyWnd',NIL);
if not GetWindowRect(TrayWindow,WindowRect) then
Exit;
{ 获得小图标大小}
SmallIconWidth := GetSystemMetrics(SM_CXSMICON);
SmallIconHeight := GetSystemMetrics(SM_CYSMICON);
{ 保存当前鼠标位置}
GetCursorPos(CursorPos);
{ 使鼠标快速划过每个图标 }
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;
{恢复鼠标位置}
SetCursorPos(CursorPos.X,CursorPos.Y);
{ 重画任务栏 }
RedrawWindow(TrayWindow,NIL,0,RDW_INVALIDATE OR RDW_ERASE OR RDW_UPDATENOW);
end;
(请参考VB6版:清理任务栏残留图标VB6版 附源程序)
http://blog.csdn.net/tanaya/archive/2006/09/20/1253038.aspx
//任务栏右下角的快捷图标有时并不会随着程序的关闭而消失
//只有当鼠标划过时才消失
//下面的函数可以通过自动划过并清除这些图标
procedure RemoveDeadIcons;
var
TrayWindow : HWnd;
WindowRect : TRect;
SmallIconWidth : Integer;
SmallIconHeight : Integer;
CursorPos : TPoint;
Row : Integer;
Col : Integer;
begin
{ 获得任务栏句柄和边框}
TrayWindow := FindWindowEx(FindWindow('Shell_TrayWnd',NIL),0,'TrayNotifyWnd',NIL);
if not GetWindowRect(TrayWindow,WindowRect) then
Exit;
{ 获得小图标大小}
SmallIconWidth := GetSystemMetrics(SM_CXSMICON);
SmallIconHeight := GetSystemMetrics(SM_CYSMICON);
{ 保存当前鼠标位置}
GetCursorPos(CursorPos);
{ 使鼠标快速划过每个图标 }
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;
{恢复鼠标位置}
SetCursorPos(CursorPos.X,CursorPos.Y);
{ 重画任务栏 }
RedrawWindow(TrayWindow,NIL,0,RDW_INVALIDATE OR RDW_ERASE OR RDW_UPDATENOW);
end;
(请参考VB6版:清理任务栏残留图标VB6版 附源程序)
http://blog.csdn.net/tanaya/archive/2006/09/20/1253038.aspx
相关文章推荐
- 清理任务栏残留图标Delphi版 附源程序
- 清理任务栏残留图标Delphi版 附源程序 .
- 清理任务栏残留图标VB6版 附源程序
- 清理任务栏残留图标VB6版 附源程序
- 清除异常关闭进程的任务栏托盘区残留图标
- 清理win7任务栏图标
- //刷新任务栏图标 终止别的进程序有些程序有托盘会残留
- 【进程处理】4,刷新任务栏托盘区,清除异常关闭进程的残留图标
- windows清理图标缓存并重新加载
- win7程序(任务栏右下角)小图标应该如何设置才最合理
- 处理win7任务栏通知区域图标异常问题
- Windows Server 2016-清理残留域控信息
- windows開始菜单和任务栏图标显示空白而且点击时候显示项目已被移动或删除
- 任务栏程序图标显示白色的解决方法
- 让WinForm应用程序最小化图标显示在任务栏并提供右击菜单
- 点击任务栏图标让窗体可以隐藏或显示(FormBorderStyle设置为None)
- 为什么不能把图标放入WIN7任务栏了
- win7下清理已卸载软件的通知区域图标
- C#编写最小化时隐藏为任务栏图标
- win7笔记本任务栏通知区域里电源图标不见或呈灰色的解决方法