🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Detecting windows shudtown.

#5800
From: Heinrich Wolf
Date: Sun, 03 Jul 2005 08:59
41 lines
2007 bytes
"qyte" <gyte@vivodinet.gr> schrieb im Newsbeitrag 
news:42c5edce$1@newsgroups.borland.com...
...
> I have intercepted it using the WndProc of the main form
> but nothing happens. is there something wrong with that?

This is how to create the event handler:

main.h

class TMainForm : public TForm
{
__published: // Von der IDE verwaltete Komponenten
 TCheckBox *cbEndSession;
 TMemo     *Memo;
private: // Anwender-Deklarationen
public:  // Anwender-Deklarationen
 __fastcall TMainForm(TComponent* Owner);
protected:
 void __fastcall WMQueryEndSession(TMessage &Message);
BEGIN_MESSAGE_MAP
  VCL_MESSAGE_HANDLER(WM_QUERYENDSESSION, TMessage, WMQueryEndSession)
END_MESSAGE_MAP(TComponent)
};

main.cpp
void __fastcall TMainForm::WMQueryEndSession(TMessage &Message)
{
 AnsiString s;
 if (Message.LParam == (long) ENDSESSION_LOGOFF)
   s = "QueryEndSession: Log off";
 else
   s.sprintf("QueryEndSession: %ld", Message.LParam);
 Memo->Lines->Add(s);
 if (cbEndSession->Checked)
   Memo->Lines->Add("Allowing end of session");
 else
   Memo->Lines->Add("Denying end of session");
 Message.Result = cbEndSession->Checked;
}
Technical Details
Message-ID: <3ipnmmFm02rkU1@individual.net>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <42c4f6c9$1@newsgroups.borland.com> <42c50d9b$2@newsgroups.borland.com> <42c5edce$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6f249ce41ad1dc44
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: "Heinrich Wolf" <invalid@invalid.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Detecting windows shudtown.
Date: Sun, 3 Jul 2005 10:59:01 +0200
Lines: 43
Message-ID: <3ipnmmFm02rkU1@individual.net>
References: <42c4f6c9$1@newsgroups.borland.com> <42c50d9b$2@newsgroups.borland.com> <42c5edce$1@newsgroups.borland.com>
X-Trace: individual.net tautyjuSez4+C21a+3zxIgAUQ8pGEyV2h9T0oI5QeVaoTZnqyN
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response