🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Before Shutting Down the PC

#6705
From: Grety
Date: Fri, 15 Apr 2005 15:10
25 lines
1847 bytes
I found the text below but I couldn't understand it
Someone please tell me. thx
//-----------------------------------------
Respond correctly to Windows shutdown WM_QUERYENDSESSION
Posted: 21 Jan 2005 06:48 AM
I have an application which minimizes to systemtray when the close button is
pressed. How ever when shutting down windows the application keeps windows
from doing so.
I have made the following implementation i order to catch the windows
message WM_QUERYENDSESSION

protected override void WndProc(ref Message m)
{
    base.WndProc(ref m);
    // WM_QUERYENDSESSION
    if (m.Msg == 0x11) {
        //close up
        Application.Exit();
    }
}

Now my application shutsdown (I have checked in taskmanager) but still
windows keeps running. Second time I ask for a shutdown it works. So my
question is how do I respond correctly to the windows shutdown request?
//-----------------------------------------
Technical Details
Message-ID: <425fe54e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <425ebafb@newsgroups.borland.com> <425ebef8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,92564fdeda5ee096
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Grety" <valid@emailaddress.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <425ebafb@newsgroups.borland.com> <425ebef8@newsgroups.borland.com>
Subject: Re: Before Shutting Down the PC
Date: Fri, 15 Apr 2005 19:40:30 +0430
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2479.0006
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006
NNTP-Posting-Host: 217.219.105.193
Message-ID: <425fe54e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1113580878 217.219.105.193 (15 Apr 2005 09:01:18 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail