Windows API:保证窗口收到的第一条消息是什么? [英] Windows API: What is the first message a window is guaranteed to receive?

查看:77
本文介绍了Windows API:保证窗口收到的第一条消息是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经习惯于认为WM_CREATE是窗口接收到的第一条消息.但是,当在顶级窗口上测试此假设时,事实证明它是错误的.在我的测试中,WM_MINMAXINFO出现为第一条消息.

I've been used to thinking that WM_CREATE is the first message a window receives. However, when testing this assumption on a top-level window, it turns out to be false. In my test, WM_MINMAXINFO turned up as the first message.

那么,保证窗口收到的第一条消息是什么?

So, what is the first message a window is guaranteed to receive?

推荐答案

您回答了自己的问题.我也看到Windows XP SP3上的WM_GETMINMAXINFO,然后是WM_NCCREATE,WM_NCCALCSIZE,最后是WM_CREATE,直到CreateWindowEx()甚至还没有将句柄返回给正在创建的窗口.什么垃圾'

You answered your own question. I too see WM_GETMINMAXINFO, on Windows XP SP3, followed by WM_NCCREATE, WM_NCCALCSIZE, and finally WM_CREATE before CreateWindowEx() has even returned the handle to the window being created. What garabage'

通常的答案是,在涉及对象的有序创建和销毁方面,微软是无能的.他们用Windows,COM和设备驱动程序弄错了.总是有一些catch-22,其中一个对象的一半被创建或一半被破坏,需要某种回旋的解决方案才能产生可​​靠的产品.

The general answer is that Microsoft is incompetent when it comes to orderly creation and destruction of objects. They get it wrong with windows, with COM, and with device drivers. There's always some catch-22 where an object is half-created or half-destroyed that requires some roundabout convoluted solution to produce a reliable product.

这篇关于Windows API:保证窗口收到的第一条消息是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆