🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TTrayIcon and Shutdown (one step later)

#1049
From: JohnC
Date: Thu, 15 Nov 2007 23:51
52 lines
2463 bytes
Is this what you are looking for?

   // Shut down the system and force all applications to close.

   if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, 0))
      return FALSE;

   return TRUE;

John

"Marc" <info@mawnet.com> wrote in message 
news:473cd9cf$1@newsgroups.borland.com...
> 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: <473cdb9a$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
References: <473cd9cf$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a42b7d249fb2d6b7
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "JohnC" <jcibulskis@sbcglobal.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <473cd9cf$1@newsgroups.borland.com>
Subject: Re: TTrayIcon and Shutdown (one step later)
Date: Thu, 15 Nov 2007 17:51:54 -0600
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 76.223.245.175
Message-ID: <473cdb9a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1195170714 76.223.245.175 (15 Nov 2007 15:51:54 -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