使用 C++ 编程时如何在 win32 中创建子窗口? [英] How should I create a child window in win32 while programming with C++?

查看:23
本文介绍了使用 C++ 编程时如何在 win32 中创建子窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 C++ 以及 windows 编程的新手..

i'm new to C++ as well as for windows programming..

我使用 msdn CreateWindow() 函数创建了一个窗口

i have created a window using msdn CreateWindow() function

哪个工作正常..现在我想创建一个子窗口...父窗口应该控制子窗口...

which works correctly..now i would like to create a child window...the parent window should control the child window...

关于此的任何帮助示例代码.

Any helps sample code regarding this .

提前致谢

推荐答案

粗略地说,在父级的处理程序中,您希望在其中创建子级,您调用 CreateWindow,传入窗口对于作为 hwndParent 的父级,您可能还想在子级上设置某些样式,例如 WS_CHILD.您与子窗口的交互取决于您创建的窗口的类型.某些窗口(例如按钮)被设计为子窗口,因此它们会发送大量通知消息,因此您需要设置父窗口来监听这些通知消息.

Roughly speaking, in the handler for the parent, where you wish to create the child, you call CreateWindow, passing in the window for the parent as the hwndParent - probably, you also want to set certain styles on the child such as WS_CHILD. Your interaction with the child window then depends on the type of the window you created. Some windows (such as buttons) are designed to work as child windows, so they send a lot of notification messages, so you would set up your parent to listen for those notification messages.

这篇关于使用 C++ 编程时如何在 win32 中创建子窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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