利用程序杀掉指定的进程,但此时托盘的图标仍然存在,该怎么才能在杀掉进程后,让图标也自动消失呢?谢谢

解决方案 »

  1.   

    "杀掉进程的时候通知托盘区刷新一下"
    这个有什么api函数吗?
    比如说我利用程序杀掉了msn的程序,可是msn的图标还在,如何才能通知托盘,让msn的图标自动消失掉?谢谢~~~
      

  2.   

    没做过,估计先查找托盘区的句柄,然后向其发送个MOUSE_MOVE的消息即可
      

  3.   

    shell_notifyicona(NIM_DELETE, @ntida);
      

  4.   

    shell_notifyicona(NIM_DELETE, @ntida);这个应该不行,因为进程已经被杀掉了
      

  5.   

    如果该托盘是你自己的程序的话
    我的思路是这样的
    hook杀进程的函数,在杀进程的时候通过进程间通信,向自己的进程发一消息删除托盘。
    如果说该杀进程的工具是你写的那就更好办了。
      

  6.   

    GInt := 0;
      hWnd := FindWindow('Shell_TrayWnd', nil);  if hWnd <> INVALID_HANDLE_VALUE   then
      begin
        EnumChildWindows(hWnd, @EnumChildWndProc, 0);    iLen := Trunc((GRect.Right - GRect.Left)/GInt);
        Y := Trunc((GRect.Top + GRect.Bottom)/2);    For I := 0 to GInt-1 do
        begin
          APoint := Point(GRect.Left + I*iLen-2, Y);
          Mouse.CursorPos := APoint;
          Sleep(1000);
        end;
      end;
    function  EnumChildWndProc(AhWnd:LongInt;
      AlParam:lParam):boolean;stdcall;
    var
      WndClassName: array[0..254]   of   Char;
    begin
      GetClassName(AhWnd, wndClassName, 254);
      Inc(GInt);  if SameText('TrayNotifyWnd', wndClassName) then
        GetWindowRect(AhWnd, GRect);
        
      result:=true;
    end;
    期间还存在一些小的BUG,你自己调试一下吧,就是效果特别的理想,鼠标慢腾腾的。