🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools.mfc
Article #137

Re: How to Kill a Tray icon from an another application ?

#137
From: Jem Berkes
Date: Thu, 23 Nov 2000 00:00
26 lines
2348 bytes
Is the icon displayed in the system tray just the icon handle from the
"Title TrayIconWindow" window class? I'm trying to figure out how to
retrieve this icon.

How exactly are you retrieving ID_TrayIcon? According to MSDN,
NOTIFYICONDATA.uID is "Application-defined identifier of the taskbar
icon"

>     First, retrieve the Window which manages the callback of the tray. (Use
> Spy++, if you have no idea, it's often the "About box" displayed when you
> click on the trayicon). Then just reminds the title of this Window; we
> called it "Title TrayIconWindow" in the sample below. Retrieve the value of
> the ID of the TrayIcon  (Use spy++...) called ID_TrayIcon in the sample
> below...
> Then retrieve the handle of the window from your application, before killing
> the application which creates the TrayIcon like that :
> HwndTrayIconWnd = FindWindow (NULL, "Title TrayIconWindow");
> Kill the application then...
> 
> NOTIFYICONDATA nd;
> 
> nd.cbSize = sizeof (nd);
> nd.hwnd = HwndTrayIconWnd;
> nd.uID = ID_TrayIcon;
> 
> ShellNotify_Icon (NIM_DELETE, &nd);
Technical Details
Message-ID: <3A1DDF20.D1731E47@pc9.CutThis.org>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <FU8R5.763$%o6.2878648@nnrp3.proxad.net> <enTSzhLUAHA.250@cppssbbsa02.microsoft.com> <8v6T5.648$NT.1224749@nnrp2.proxad.net>

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: 1053e6,d00bad325b1977a5
X-Google-Attributes: gid1053e6,public
X-Google-Thread: f5082,d00bad325b1977a5
X-Google-Attributes: gidf5082,public
X-Google-Thread: 113dfb,d00bad325b1977a5
X-Google-Attributes: gid113dfb,public
X-Google-Thread: 104d65,d00bad325b1977a5
X-Google-Attributes: gid104d65,public
From: Jem Berkes <jem@pc9.CutThis.org>
Subject: Re: How to Kill a Tray icon from an another application  ?
Date: 2000/11/23
Message-ID: <3A1DDF20.D1731E47@pc9.CutThis.org>
X-Deja-AN: 697278305
Content-Transfer-Encoding: 7bit
References: <FU8R5.763$%o6.2878648@nnrp3.proxad.net> <enTSzhLUAHA.250@cppssbbsa02.microsoft.com> <8v6T5.648$NT.1224749@nnrp2.proxad.net>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: admin@mts.net
X-Trace: news1.mts.net 975036183 216.130.69.103 (Thu, 23 Nov 2000 21:23:03 CST)
Organization: PC9
MIME-Version: 1.0
NNTP-Posting-Date: Thu, 23 Nov 2000 21:23:03 CST
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