CDialog OnCreate与OnInitDialog [英] CDialog OnCreate vs OnInitDialog

查看:154
本文介绍了CDialog OnCreate与OnInitDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当为无模数对话框创建控件时
最好播放一条消息,

OnInitdialog或OnCreate

我的意思是哪个虚函数?

When Create controls for a Modless Dialog
Durning which message is it best to do So

OnInitdialog or OnCreate

I meant which virtual functions ??

推荐答案

OnCreate仅在应用程序请求调用Create函数时被调用.因此,不能保证窗口已完全创建. OnInitDialog在完全创建窗口(在本例中为对话框)之后调用.
动态创建控件时,将指定其父窗口句柄,因此必须完全创建它.因此,请始终按照前面的答案在OnInitDialog中进行操作.

OnCreate is called just when the application requests that the Create function be called. So it is not guarenteed that the window is fully created. OnInitDialog is called after the window (in this case the dialog) is completely created.
When you are dynamically creating a control, you will specify its parent window handle and so it has to be created completely. So always do it in OnInitDialog as said in the previous answer.


这篇关于CDialog OnCreate与OnInitDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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