有一个别人的程序,我需要定时杀它的进程,但是会在托盘遗留下它的托盘图标,只要鼠标一移到上面就会消失,但是怎么用程序控制,每当我杀掉它的进程,就自动刷新托盘图标或者让它消失。
我试着找了一些代码,如SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST+SHCNF_FLUSH,nil,nil);这样的刷新并不起作用。
我试着找了一些代码,如SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST+SHCNF_FLUSH,nil,nil);这样的刷新并不起作用。
解决方案 »
- 学会Delphi 要多长时间?
- CSDN这次改版改得太垃圾了
- 为什么我的DLL里运行时不能单步跟踪?
- 关于鼠标右击的问题,在线等待,谢谢
- 新手上路,关于csv(excel文件)类型的读数据问题,能否使用F1BOOK控件,请高手指教,谢谢!
- 如何用ADO控件读取.DBF表
- 让combobox中的每一项对应一个id(id无规律)该如何写?
- 求助, 怎么让treeview控件一开始就是展开状态,
- ▲▲▲▲SQL语句问题!!!▲▲▲▲
- 怎样在DBGrid中重新执行我在Field中定义的OnGetText事件?
- DELPHI中如何使用QuickReport控件将查询结果生成的报表
- 请教4个字符如何通过一个算法变成两个字符啊,字符都是数据型的,然后还能还原啊!
http://www.ccrun.com/article.asp?i=617&d=5sbm2o
var
hTrayWindow:HWND;
rctTrayIcon:TRECT;
nIconWidth,nIconHeight:integer;
CursorPos:TPoint;
nRow,nCol:Integer;
Begin
// Get tray window handle and bounding rectangle
hTrayWindow := FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'TrayNotifyWnd', nil);
if Not (GetWindowRect(hTrayWindow, rctTrayIcon)) then
Exit;
// Get small icon metrics
nIconWidth := GetSystemMetrics(SM_CXSMICON);
nIconHeight := GetSystemMetrics(SM_CYSMICON);
// Save current mouse position }
GetCursorPos(CursorPos);
// Sweep the mouse cursor over each icon in the tray in both dimensions
for nRow:=0 To ((rctTrayIcon.bottom-rctTrayIcon.top) div nIconHeight) Do
Begin
for nCol:=0 To ((rctTrayIcon.right-rctTrayIcon.left)div nIconWidth) Do
Begin
SetCursorPos(rctTrayIcon.left + nCol * nIconWidth + 5,
rctTrayIcon.top + nRow * nIconHeight + 5);
Sleep(0);
end;
end;
// Restore mouse position
SetCursorPos(CursorPos.x, CursorPos.x);
// Redraw tray window (to fix bug in multi-line tray area)
RedrawWindow(hTrayWindow, nil, 0, RDW_INVALIDATE Or RDW_ERASE Or RDW_UPDATENOW);
end;