我认为这是因为PostQuitMessage不可能知道 我希望它能够运行。那么为什么文档会建议你使用 呢? 解决方案 > PostQuitMessage(?)与PostMessage有什么不同(hWnd,WM_QUIT,...)?我在DLL中遇到了一个窗口(同一个遇到下面的问题,WM_QUIT的返回值)哪个PostMessage(hWnd,WM_QUIT,...)有效,但PostQuitMessage没有。 PostQuitMessage可能会做一些内务处理并设置一个信号所以 GetMessage和PeekMessage表现得恰当。 至于为什么你的代码与你所说的并且不与PQM一起工作我 不能说因为你没有提供任何相关信息。 大概你的消息循环代码有些奇怪吗? Dave - MVP VC ++ FAQ: http://www.mvps.org/vcfaq 我认为引入PostQuitMessage的主要原因是因为在Win16中没有没有PostThreadMessage。即使在主要的窗口被销毁或被销毁之后,PostQuitMessage也能正常工作。 它还可以确保队列中所有待处理的消息都得到处理 $ b循环中断前$ b。 PostMessage(WM_QUIT)可能不会给出这样的保证。 David Lowndes <哒**** @ example.invalid>在消息中写道 新闻:ka ******************************** @ 4ax.com ... PostQuitMessage(?)与PostMessage(hWnd,WM_QUIT,...)有什么不同?我有一个窗口DLL(同一个遇到下面的问题,WM_QUIT的返回值),其中PostMessage(hWnd,WM_QUIT,...)有效,但是PostQuitMessage没有。 PostQuitMessage可能会做一些内务处理并设置一个信号,以便GetMessage和PeekMessage表现得恰当。 至于为什么你的代码适用于什么你说并且没有PQM我不能说因为你没有提供任何相关的信息。大概你的消息循环代码有些奇怪吗? Dave - MVP VC ++ FAQ: http: //www.mvps.org/vcfaq >我认为引入PostQuitMessage的主要原因是因为在Win16中没有PostThreadMessage。 因为没有任何线程它会很难;) 它还可以确保队列中所有待处理的消息都是在循环中断之前处理。 PostMessage(WM_QUIT)可能不会给出这样的保证。 是的,这肯定是可能的。 Dave - MVP VC ++常见问题解答: http: //www.mvps.org/vcfaq Is PostQuitMessage(?) different to PostMessage(hWnd, WM_QUIT, ... ) ?I''ve got a window in a DLL (the same one experiencing the issue below,"return value of WM_QUIT") in which PostMessage(hWnd, WM_QUIT, ... ) works,but PostQuitMessage doesn''t.I would assume this to be the case as PostQuitMessage can''t possibly knowthe hWnd I''m wanting it to operate on. So why does the docs advise you to usethat? 解决方案 >Is PostQuitMessage(?) different to PostMessage(hWnd, WM_QUIT, ... ) ?I''ve got a window in a DLL (the same one experiencing the issue below,"return value of WM_QUIT") in which PostMessage(hWnd, WM_QUIT, ... ) works,but PostQuitMessage doesn''t.PostQuitMessage probably does some housekeeping and sets a signal sothat GetMessage and PeekMessage behave appropriately.As to why your code works with what you say and doesn''t with PQM Ican''t say because you''ve not provided any relevant information.Presumably there''s something odd with your message loop code?Dave--MVP VC++ FAQ: http://www.mvps.org/vcfaqI think the primary reason to introduce PostQuitMessage was because therewas no PostThreadMessage in Win16. PostQuitMessage works even after the mainwindow is destroyed or is being destroyed.It may also make sure that all pending messages in the queue are handledbefore the loop breaks. PostMessage(WM_QUIT) may not give such guarantee."David Lowndes" <da****@example.invalid> wrote in messagenews:ka********************************@4ax.com...Is PostQuitMessage(?) different to PostMessage(hWnd, WM_QUIT, ... ) ?I''ve got a window in a DLL (the same one experiencing the issue below,"return value of WM_QUIT") in which PostMessage(hWnd, WM_QUIT, ... )works,but PostQuitMessage doesn''t. PostQuitMessage probably does some housekeeping and sets a signal so that GetMessage and PeekMessage behave appropriately. As to why your code works with what you say and doesn''t with PQM I can''t say because you''ve not provided any relevant information. Presumably there''s something odd with your message loop code? Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq>I think the primary reason to introduce PostQuitMessage was because therewas no PostThreadMessage in Win16.As there weren''t any threads it''d have been difficult ;)It may also make sure that all pending messages in the queue are handledbefore the loop breaks. PostMessage(WM_QUIT) may not give such guarantee.Yes that''s certainly a possibility.Dave--MVP VC++ FAQ: http://www.mvps.org/vcfaq 这篇关于PostQuitMessage与PostMessage不同(hWnd,WM_QUIT,......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-25 22:07