如果在初始化后立即调用SetDlgItemText,则不会显示对话框 [英] Dialog box won't show up if SetDlgItemText is called right after initialization
问题描述
我需要创建一个对话框,其中包含一个文本框,只要打开对话框,该文本框就会填充来自对象的数据。为此,我在对话框的回调函数中使用以下代码:
switch(message)
{
case WM_INITDIALOG:
{
PersistentObj.InitDialog(hDlg);
return(INT_PTR)TRUE;
}
反过来,InitDialog有一个工作:调用SetDlgItemText。但是,当我使用此调用运行程序时,对话框将不会显示。当我注释掉调用并重新运行程序时,会出现对话框。
我正在使用Visual Studio 2012。
使用Visual Studio 2013,包含编辑控件的模态和无模式对话框已成功创建并使用以下方式显示:
case WM_INITDIALOG:
SetDlgItemText(hDlg,IDC_EDIT1,L" This is a test");
return(INT_PTR)TRUE;
休息;
调用PersistenObj.InitDialog(hDlg)执行的代码是什么?
I need to make a dialog box that has a text box that is to be populated with data from an object whenever the dialog box is opened. To do this, I use the following code within the dialog box's callback function:
switch (message) { case WM_INITDIALOG: { PersistentObj.InitDialog(hDlg); return (INT_PTR)TRUE; }
InitDialog, in turn, has one job: Call SetDlgItemText. However, when I run the program with this call, the dialog box won't show up. When I comment out the call and re-run the program, the dialog box shows up.
I am using Visual Studio 2012.
Using Visual Studio 2013 both modal and modeless dialogs that contained an edit control were successfully created and displayed using :
case WM_INITDIALOG: SetDlgItemText(hDlg, IDC_EDIT1, L"This is a test"); return (INT_PTR)TRUE; break;
What is the code executed by your call to PersistenObj.InitDialog(hDlg)?
这篇关于如果在初始化后立即调用SetDlgItemText,则不会显示对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!