🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

TTrayIcon and Shutdown (one step later)

#1048
From: Marc
Date: Thu, 15 Nov 2007 23:43
35 lines
2070 bytes
Hi all

I read a lot about the TTrayIcon component and its problems with detecting 
the WM_ENDSESSION with formless applications.

So I took the source and modified the code in order to call an event in the 
application in addition to simply call Shell_NotifyIcon(NIM_DELETE, &FData).

void __fastcall TMyTrayIcon::EndSession()
{
   OnEndSession(this);
   Shell_NotifyIcon(NIM_DELETE, &FData);
}
//---------------------------------------------------------------------------

In the OnEndSession event my application then does some cleanup and calls
Application->Terminate();

When running the application and log off, the WM_ENDSESSION is caught by 
TMyTrayIcon, the OnEndSession event is fired and my application shuts down 
correctly.

But Windows does not continue with the shutdown...

Does anyone have an idea why or how to get Windows to complete the shut down 
(logoff)?

This problem bugs me now for quite a while. I have tried alternatives like 
the ShutDownWatcher but without success :-(
Does anyone has a version of TTrayIcon that allows to define a shut down 
event?


Rds
Marc
Technical Details
Message-ID: <473cd9cf$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a42b7d249fb2d6b7,start
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Marc" <info@mawnet.com>
From: "Marc" <info@mawnet.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: TTrayIcon and Shutdown (one step later)
Date: Fri, 16 Nov 2007 00:43:22 +0100
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 83.76.41.19
Message-ID: <473cd9cf$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1195170255 83.76.41.19 (15 Nov 2007 15:44:15 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail