句柄hwnd和cwnd窗口类关系的正解!

本文探讨了C++中CWnd对象与Windows窗口之间的关联。CWnd对象直接由程序创建,而Windows窗口则通过CWnd对象的Create成员函数调用创建,标识为窗口句柄(HWND)。文中详细解释了窗口的创建与销毁过程,以及窗口句柄在CWnd对象中的存储方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The window object is an object of the C++ CWnd class (or a derived class) that your program creates directly. It comes and goes in response to your program's constructor and destructor calls. 

The Windows window, on the other hand, is an opaque handle to an internal Windows data structure that corresponds to a window and consumes system resources when present. 

A Windows window is identified by a "window handle" (HWND句柄) and is created after the CWnd object is created by a call to the Create member function of class CWnd窗口类

The window may be destroyed either by a program call or by a user's action. The window handle is stored in the window object's m_hWnd member variable. 

The following figure shows the relationship between the C++ window object and the Windows window. Creating windows is discussed in Creating Windows. Destroying windows is discussed in Destroying Window Objects.

CWnd window object and resulting window
Window Object and Windows Window

原来如此

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值