Article View: comp.os.ms-windows.programmer.tools.mfc
Article #146Re: How to Kill a Tray icon from an another application ?
From: Asymmetric
Date: Sat, 18 Nov 2000 00:00
Date: Sat, 18 Nov 2000 00:00
90 lines
4435 bytes
4435 bytes
Hi all,
How can I use something along these methods to return the command id and
tooltip text of each tray icon? And does this work to retrieve the rect of
each tray icon? I tried all sorts of stuff to retrieve the TOOLINFO or the
TBBUTTONINFOA to no avail... please assist if possible,
TIA,
Jay.
"Aurelian Coasan [MS]" <mtsis@microsoft.com> wrote in message
news:enTSzhLUAHA.250@cppssbbsa02.microsoft.com...
> Hi!
>
> an interesting question; so i took a look at it.
> in my tests neither adding and deleting a new status area icon nor
> invalidating the status area window worked.
> so i came up with the following solution. (it seems a little unprecise,
but
> i'll append also one of the attempts i made, to show that the "normal",
> more professional trials didn't work.) the one i show after the solution,
> which uses TB_GETITEMRECT doesn't work (the message returns TRUE, but the
> contents of the RECT are not valid, hence this not very precise variant i
> came up with eventually - but try it, i tested it on win2k and didn't
> encounter problems, but who knows..., i don't guarantee anything - it
could
> hide surprises):
> =========================================
> solution:
>
> HWND hwndTaskBar, hwndTrayWnd, hwndTrayToolBar;
> BOOL res;
> hwndTaskBar = FindWindowEx (NULL, NULL, "Shell_TrayWnd", NULL);
> hwndTrayWnd = FindWindowEx (hwndTaskBar , NULL, "TrayNotifyWnd", NULL);
> hwndTrayToolBar = FindWindowEx(hwndTrayWnd, NULL, "ToolbarWindow32",
NULL);
> RECT rTrayToolBar;
> ::GetClientRect(hwndTrayToolBar, &rTrayToolBar);
> for (WORD x = 0; x < rTrayToolBar.right ; x += 8)
> for (WORD y = 0; y < rTrayToolBar.bottom ; y +=8)
> ::SendMessage(hwndTrayToolBar , WM_MOUSEMOVE, 0,
> MAKELPARAM(x,y) );
> ==========================================
> this doesn't work (at least on win2k not):
> LONG lNrButtons = (LONG)::SendMessage(hwndTrayToolBar, TB_BUTTONCOUNT,
> 0, 0);
> RECT rButton;
> for (LONG i = 0; i < lNrButtons; i++)
> {
> res = ::SendMessage(hwndTrayToolBar,
> TB_GETITEMRECT,
> (WPARAM) i,
> (LPARAM) &rButton);
> ::SendMessage(hwndTrayToolBar,
> WM_MOUSEMOVE,
> 0,
> MAKELPARAM
> (
> (WORD) ((rButton.left + rButton.right) /2),
> (WORD) ((rButton.top + rButton.bottom ) / 2)
> )
> );
> }
>
> hth,
> -aurelian
>
> "CG" <cgranottier@nospamseres.fr> schrieb im Newsbeitrag
> news:FU8R5.763$%o6.2878648@nnrp3.proxad.net...
> > In my program, I make a system kill of an application that have an icon
> tray
> > in the traybar...
> > But the problem is that the icon isn't kill properly by the killed
> > application to the task icon remains here.
> > The only way to delete the tray icon is to move the mouse over the tray
> > icon, but I'd like to di it in my programm after I kill the application.
> > I try something like that :
> >
> > hwndTaskBar = FindWindowEx (NULL, NULL, "Shell_TrayWnd", NULL);
> > hwndTrayWnd = FindWindowEx (hwndTaskBar , NULL, "TrayNotifyWnd", NULL);
> >
> > and then SendMEssage (hwndTrayWnd , WM_PAINT, 0, 0);
> >
> > but it doesn't work.
> > Any idea ???
> > Chris.
> >
> >
>
>
Technical Details
Message-ID:
<ZyrR5.22982$nY.97391@typhoon.hawaii.rr.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<FU8R5.763$%o6.2878648@nnrp3.proxad.net> <enTSzhLUAHA.250@cppssbbsa02.microsoft.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1138df,d00bad325b1977a5 X-Google-Attributes: gid1138df,public X-Google-Thread: 113dfb,d00bad325b1977a5 X-Google-Attributes: gid113dfb,public X-Google-Thread: 104d65,d00bad325b1977a5 X-Google-Attributes: gid104d65,public X-Google-Thread: f5082,d00bad325b1977a5 X-Google-Attributes: gidf5082,public X-Google-Thread: 1053e6,d00bad325b1977a5 X-Google-Attributes: gid1053e6,public From: "Asymmetric" <Asymmetric@hotmail.com> Subject: Re: How to Kill a Tray icon from an another application ? Date: 2000/11/18 Message-ID: <ZyrR5.22982$nY.97391@typhoon.hawaii.rr.com> X-Deja-AN: 695036252 References: <FU8R5.763$%o6.2878648@nnrp3.proxad.net> <enTSzhLUAHA.250@cppssbbsa02.microsoft.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Complaints-To: abuse@rr.com X-Trace: typhoon.hawaii.rr.com 974538041 204.210.116.91 (Fri, 17 Nov 2000 23:00:41 HST) Organization: Asymmetric@hotmail.com X-MSMail-Priority: Normal NNTP-Posting-Date: Fri, 17 Nov 2000 23:00:41 HST Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.os.ms-windows.programmer.win32,fr.comp.os.ms-windows.programmation,microsoft.public.fr.vc,microsoft.public.vc.mfc