Win32,WndProc和父子窗口 [英] Win32 , WndProc, and parent-child windows

查看:224
本文介绍了Win32,WndProc和父子窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Win32 Api创建多个窗口的C代码进行开发. 我两次使用createWindow-创建父窗口和子窗口. 我有一个消息循环

I'm developing in C code that uses the Win32 Api to create multiple windows. I used createWindow twice - to create parent and child windows. I have a message loop

while ( GetMssage (&msg, NULL,0,0)){
.
translate
dispatch
. 
}

但是我只调用一次WND_Proc函数,而不是每个窗口两次.

But I only get the WND_Proc function called once, instead of twice for each of the windows.

我在做什么错了?

推荐答案

如果我正确理解了您的问题,则您应该希望WndProc会为为其创建的每个窗口类的所创建的每个窗口收到一条WM_CREATE消息. WndProc已注册.

If I'm understanding your question correctly, you should expect your WndProc to receive a single WM_CREATE message for each window created of the window class for which the WndProc is registered.

您的WndProc将不会为您创建的其他类的窗口(例如,像标准Windows UI控件)收到WM_CREATE,即使它是WndProc类别的窗口的直接子代也是如此.如果您向我们提供了有关您要完成的工作的更多详细信息,我们可以提供建议或解决方法.

Your WndProc will not receive a WM_CREATE for a window you create of a different class (like the standard Windows UI controls, for example), even if it is a direct child of a window of the WndProc's class. If you gave us some more specifics on what you are trying to accomplish we could provide suggestions or workarounds.

这个问题也可能会消失更多了解您的情况.

This question may also shed some more light on your situation.

这篇关于Win32,WndProc和父子窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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