Re: Relationship between Application.Exit() and AppDomain
- From: "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx>
- Date: Tue, 8 Apr 2008 19:15:28 +0200
"Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx> wrote in message news:uOlihGYmIHA.484@xxxxxxxxxxxxxxxxxxxxxxx
Willy Denoyette [MVP] wrote:"Barry Kelly" <barry.j.kelly@xxxxxxxxx> wrote in message
news:4djkv39krr67nr7f3fjttfi86581in3gpm@xxxxxxxxxx
Willy Denoyette [MVP] wrote:
"Barry Kelly" <barry.j.kelly@xxxxxxxxx> wrote:
Willy Denoyette [MVP] wrote:
Application.Exit() is a Forms API,
That is true.
Well here you are calling PostQuitMessage which doesn't really do
what it's
supposed to do
PostQuitMessage posts WM_QUIT to the current thread's message queue.
This is no different in a WPF application than in any other Windows
application. WM_QUIT causes GetMessage to return 0.
Well, It doesn't post a WM_QUIT message to the UI's thread queue when
run on Vista (both RTM and SP1), of course it does post WM_QUIT when
called in a Windows.Forms based application (or any non managed
windows app.).
Barry has this one exactly right. PostQuitMessage is a Win32 function, it couldn't care less whether your app is WPF or WinForms or MFC or whatever. It posts WM_QUIT and returns.
I don't know how you can get any clearer than this:
http://msdn2.microsoft.com/en-us/library/ms644945(VS.85).aspx
"The PostQuitMessage function posts a WM_QUIT message to the thread's message queue and returns immediately; the function simply indicates to the system that the thread is requesting to quit at some time in the future."
The docs are clear, but I'm afraid they are missing some additional remarks when run on Vista (don't know what happens on XP SP2 and SP3).
Please don't point to the docs to prove I'm wrong, use some debugging tools and correct me if you notice the *documented* behavior.
Running SpyXX [1] doesn't reveal any WM_QUIT message for a WPF enabled application (say the sample posted by Barry), it does (as expected) when called from any other type of application (managed Forms, and native MFC and Win32).
If you can't get Spyxx (from VS2008) to work for you, or if you don't fully trust what SPxx reveals(like I do), you can always run the app in the debugger (say Windbg), set a breakpoint on GetMessageW and inspect the MSG struct returned (there are quite a lot of them) when you call the API, you won't see any WM_QUIT message (at least I don't).
Willy.
On Vista32 SP1 and Vista64 SP1 and WS2008, all running the same v3.5 Framework bits.
.
- Follow-Ups:
- Re: Relationship between Application.Exit() and AppDomain
- From: Ben Voigt [C++ MVP]
- Re: Relationship between Application.Exit() and AppDomain
- References:
- Relationship between Application.Exit() and AppDomain
- From: Sunny S
- Re: Relationship between Application.Exit() and AppDomain
- From: Willy Denoyette [MVP]
- Re: Relationship between Application.Exit() and AppDomain
- From: Barry Kelly
- Re: Relationship between Application.Exit() and AppDomain
- From: Willy Denoyette [MVP]
- Re: Relationship between Application.Exit() and AppDomain
- From: Barry Kelly
- Re: Relationship between Application.Exit() and AppDomain
- From: Willy Denoyette [MVP]
- Re: Relationship between Application.Exit() and AppDomain
- From: Ben Voigt [C++ MVP]
- Relationship between Application.Exit() and AppDomain
- Prev by Date: Re: Relationship between Application.Exit() and AppDomain
- Next by Date: Re: Relationship between Application.Exit() and AppDomain
- Previous by thread: Re: Relationship between Application.Exit() and AppDomain
- Next by thread: Re: Relationship between Application.Exit() and AppDomain
- Index(es):
Relevant Pages
|
Loading