Article View: borland.public.cppbuilder.nativeapi
Article #860How to remove dead system tray icons
From: nicolasr
Date: Tue, 11 Dec 2007 03:15
Date: Tue, 11 Dec 2007 03:15
40 lines
2384 bytes
2384 bytes
Hi all,
I have a third party application (app1) that I need to automate.
My controller app (app2) starts app1 and watches
at certain intervals whether app1 is still alive.
Every now and then app1 crashes, needs to
automatically be terminated and restarted.
(Unfortunately I don't have source code for app1
to correct the actual problem....)
This works as expected except for the fact that
app1 has a tray icon and after app1 has been
terminated and restarted several times the tray
area expands over the entire task bar and
displays dead tray icons of app1 that would
disappear if I moved over them with the mouse.
Unfortunately nobody sits in front of the PC and all
this needs to be automated. So app2 should be able
to remove those dead icons.
I found some code like:
HWND hTaskbar = FindWindow("Shell_TrayWnd", NULL);
HWND hSysTray = FindWindowEx(hTaskbar, 0, "TrayNotifyWnd", NULL);
RECT rect;
GetWindowRect(hSysTray, &rect);
that then uses mouse_event() to simulate a user moving the mouse
over the system tray. While this works on my XP machine with one dead icon
it does not work reliably on the business W2K machine with other things
running
concurrently.
Does anyone have any ideas how to do this?
How about sending mouse messages directly to the sys tray window?
Or any other way to force explorer to update the system tray?
thanks for any idea.
Nick
Technical Details
Message-ID:
<475e00d0$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5d96c60b60120dfe,start X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "nicolasr" <nicolasrREMOVETHISSPAMBLOCKER@gmx.net> Newsgroups: borland.public.cppbuilder.nativeapi Subject: How to remove dead system tray icons Date: Tue, 11 Dec 2007 04:15:26 +0100 Lines: 41 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6000.16480 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16545 NNTP-Posting-Host: 89.13.120.12 Message-ID: <475e00d0$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1197342928 89.13.120.12 (10 Dec 2007 19:15:28 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail