🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4495

Receiving NIN_BALLOONUSERCLICK from system tray balloon

#4495
From: Kris
Date: Tue, 17 Jan 2006 17:48
43 lines
2183 bytes
The new TTrayIcon component of C++ Builder 2006 makes it very easy to
create system tray balloons :

TrayIcon1->BalloonTitle="Title";
TrayIcon1->BalloonHint="Body Text";
TrayIcon1->ShowBalloonHint();

This works great. But I also would like to handle the event when a
user clicks the balloon.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shell_notifyicon.asp
The NIN_BALLOONUSERCLICK is sent when the balloon is dismissed because
the user clicked the mouse.

The NIN_BALLOONUSERCLICK was unknown to builder 2006 so I grabbed its
definition from the Windows SDK's ShellAPI.h.

In order to catch the message I wrote this :

class TMainForm : public TForm
{
protected:
	#define NIN_BALLOONUSERCLICK (WM_USER + 5)

	void __fastcall HandleBalloonClick (TMessage &Msg);
	BEGIN_MESSAGE_MAP
		MESSAGE_HANDLER (NIN_BALLOONUSERCLICK,
TMessage,HandleBalloonClick)
	END_MESSAGE_MAP (TForm)
...
}

Finally I added :

void __fastcall TMainForm::HandleBalloonClick (TMessage &Msg)
{
	Caption="Click Balloon";
}

However, when I click the balloon to make it disappear my function
does not get called. 

Any ideas on how to receive the NIN_BALLOONUSERCLICK message ?
Technical Details
Message-ID: <0dbqs15pnttts94lrl0gfkv1qmdi5r7v2g@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2165941223f42fca,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Kris <x.y@xyz.xx>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Receiving NIN_BALLOONUSERCLICK from system tray balloon
Date: Tue, 17 Jan 2006 18:48:30 +0100
Message-ID: <0dbqs15pnttts94lrl0gfkv1qmdi5r7v2g@4ax.com>
X-Newsreader: Forte Free Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.11.237.245
X-Trace: newsgroups.borland.com 1137519950 81.11.237.245 (17 Jan 2006 09:45:50 -0700)
Lines: 43
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail