MFC CWinApp程序中的输入框? [英] Input Box in an MFC CWinApp program?

查看:76
本文介绍了MFC CWinApp程序中的输入框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个UI程序中的输入框,该输入框已被编写为派生自CWinnApp类并使用MFC.

I need an input box in a UI program that is already written derived from the CWinnApp class and using MFC.

我看到它正在使用消息框,但是我没有看到输入框的任何示例....

I see it is using message boxes but I don't see any examples of input boxes....

我该怎么做?

(在C ++中使用Visual Studio 6.0)

(Using Visual Studio 6.0 in C++)

谢谢.

推荐答案

我知道这是经常需要的,但是MFC中没有内置的输入框,因此您必须创建自己的输入框.通常,我通常只创建一个带有标签和编辑框的简单对话框(该对话框已经带有确定/取消"按钮),然后创建一个类,例如CInputDlg,为标签和编辑框添加成员变量,然后像调用它一样其他任何对话框:

I know it's something that's often required, but there isn't a built-in input box in MFC, so you'll have to create your own. I usually just create a simple dialog with a label and edit box (the dialog already comes with OK/Cancel buttons), then create a class, say CInputDlg, add member variables for the label and edit box, and just call it like any other dialog:

CInputDlg dialog;
dialog.m_label = TEXT("Enter a number:");
if (dialog.DoModal() == IDOK) {
  // Do something
}

这篇关于MFC CWinApp程序中的输入框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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