Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages
Started by dln
Thu, 01 May 2003 02:16
Closing All Windows On A Desktop
Author: dln
Date: Thu, 01 May 2003 02:16
Date: Thu, 01 May 2003 02:16
17 lines
2104 bytes
2104 bytes
I'm curious if anybody knows how the Windows Task Manager (Win2K, XP) kills a window when the "End Process" button is clicked? The reason I ask is I've written an application which attempts to close all windows on the desktop by calling DestroyWindow, passing the handle of the window to be closed as the function's parameter. For the most part, this works. However, the instance of Windows Explorer which controls the Windows shell will not close, regardless of what API call I use. In addition to DestroyWindow, I've tried posting/sending a WM_QUIT and WM_CLOSE message to the window. The WM_QUIT does nothing (the icons on the desktop might blink a bit as if they're being refreshed, but not much else), and the WM_CLOSE causes the "Are you sure you want to log off?" dialog to appear (and that's not the behavior I desire). 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), so it appears to use a function call that I'm not aware of to kill the window. Does anybody know how this is accomplished? Thanks.
Re: Closing All Windows On A Desktop
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads