Article View: borland.public.cppbuilder.nativeapi
Article #16711Re: Closing All Windows On A Desktop
From: Remy Lebeau (TeamB)
Date: Thu, 01 May 2003 03:37
Date: Thu, 01 May 2003 03:37
52 lines
2858 bytes
2858 bytes
"dln" <dnadon@nospam.austin.rr.com> wrote in message news:3eb081aa@newsgroups.borland.com... > I'm curious if anybody knows how the Windows Task > Manager (Win2K, XP) kills a window when the "End > Process" button is clicked? It first attempts to send a simple WM_CLOSE command to the various windows of the process. If the process fails to respond to the message at all (such as during a hangup), then the TaskManager brute-forces the process to terminate via TerminateProcess(). > the instance of Windows Explorer which controls the > Windows shell will not close, regardless of what API > call I use. You can't shut down the shell that way. Why would you want to? What exactly are you trying to accomplish? It almost should like you're trying to brute-force Windows to terminate. If so, you are going about it completely wrong. You should be using the ExitWindows/Ex() function for that instead. > In addition to DestroyWindow, I've tried posting/sending a > WM_QUIT and WM_CLOSE message to the window. That is the preferred way to go whenever possible. > The WM_QUIT does nothing (the icons on the desktop > might blink a bit as if they're being refreshed, but not much else) That's probably caosed by the shell reloading itself after you try to shut it down. You cannot shut down the shell manually. Only Windows can do that, and only during an actual system shutdown. > and the WM_CLOSE causes the "Are you sure you want to > log off?" dialog to appear As it should. > (and that's not the behavior I desire). Well, that's the behavior you're going to get. > The Windows Task Manager on the other hand, will > kill any instance of Explorer outright (regardless of whether > it controls the desktop shell or not) Wrong. It does not shut down the shell. That would effective kill Windows itself. Gambit
Technical Details
Message-ID:
<3eb09641$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!news.linkpendium.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3eb081aa@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,9a0a5b67bc017ec9 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-04-30 20:46:21 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3eb081aa@newsgroups.borland.com> Subject: Re: Closing All Windows On A Desktop Date: Wed, 30 Apr 2003 20:37:57 -0700 Lines: 54 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3eb09641$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1051760193 207.175.226.26 (30 Apr 2003 20:36:33 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!news.linkpendium.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail