用API结束进程后任务栏图标仍在,有什么好办法解决?解决方案

用API结束进程后任务栏图标仍在,有什么好办法解决?
PB9用API结束另一程序进程后任务栏图标仍在,
该程序有在任务栏图标显示,
进程已经结束掉了,有什么好办法把任务栏图标一起消失?

------解决方案--------------------
调用api函数把桌面刷新一下
------解决方案--------------------
用这个方法结束进程后,任务栏上的图标也不会显示了的
C/C++ code
forward
global type nvo_kill_process from nonvisualobject
end type
type s_process from structure within nvo_kill_process
end type
end forward

type s_process from structure
    unsignedlong        structsize
    unsignedlong        usage
    unsignedlong        processid
    unsignedlong        defaultheapid
    unsignedlong        moduleid
    unsignedlong        threads
    unsignedlong        parentprocessid
    unsignedlong        classbase
    unsignedlong        flags
    character        filename[200]
end type

global type nvo_kill_process from nonvisualobject autoinstantiate
end type

type prototypes
Function Long GetCurrentProcessId() Library "kernel32.dll" 
Function Long CreateToolhelp32Snapshot(Long Flags,Long ProcessId) Library "kernel32.dll" 
Function Integer Process32First(uLong Snapshot,ref s_Process Process) Library "kernel32.dll" 
Function Integer Process32Next(uLong Snapshot,ref s_Process Process) Library "kernel32.dll"
Function ulong TerminateProcess(long hProcess,ulong uExitCode) LIBRARY "kernel32.dll"
FUNCTION ulong OpenProcess(ulong  dwDesiredAccess,ulong  bInheritHandle,ulong   dwProcessId)   LIBRARY   "kernel32.dll"   

end prototypes

forward prototypes
public function integer of_kill_process (string as_pro)
end prototypes

public function integer of_kill_process (string as_pro);s_Process lst_Process //进程结构 
String ls_FileName[],ls_CurExeName //最多100个进程,可改进 
ulong ln_ProcessID,ln_Snapshot,ln_Circle,ln_Count //,ln_SameCount
string ls_Kill_File
Long ll_PID,ll_PID2

IF as_pro='' OR isnull(as_pro) Then Return 1

ln_ProcessID = GetCurrentProcessId() //取当前进程的ID 

if IsNull(ln_ProcessID) or ln_ProcessID<1 then return -1 //出错则返回 

ln_Snapshot = CreateToolhelp32Snapshot(2,0) //在堆上创建进程快照 

if (ln_Snapshot<1) then return -1 //出错则返回 

lst_Process.StructSize = 296 //Win32api的Process结构大小

if Process32First(ln_Snapshot,lst_Process)=0 then 
    return -1 //取第一个进程失败则返回 
End IF

ls_Kill_File = lst_Process.FileName

IF pos(lower(as_pro),lower(ls_Kill_File))>0 Then            
    ll_pid=Long(lst_process.processid)        
    ll_pid2 = Long(OpenProcess(1,0,ll_PID))//使该进程可读写     
    TerminateProcess(ll_PID2,1) //Kill Process
End IF

if lst_Process.ProcessID=ln_ProcessID then //如果为当前进程,不允许删除
    ls_CurExeName=lst_Process.FileName 
END IF

do while true     //循环取列举的进程名称    
    if Process32Next(ln_Snapshot,lst_Process)=0 then exit //列举完毕         
    IF lst_Process.ProcessID=ln_ProcessID Then continue  //如果是当前进程.不执行下述杀除操作.    
    ls_Kill_File = lst_Process.FileName    
    IF pos(lower(as_pro),lower(ls_Kill_File))>0 Then        
        ll_pid=Long(lst_process.processid)    
        ll_pid2 = Long(OpenProcess(1,0,ll_PID))//使该进程可读写     
        TerminateProcess(ll_PID2,1) //Kill Process    
    End IF
loop 

Return 1

end function

on nvo_kill_process.create
call super::create
TriggerEvent( this, "constructor" )
end on

on nvo_kill_process.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on