Input field in MFC CWinApp?

I need an input window in a user interface program that is already written based on the CWinnApp class and uses MFC.

I see that it uses message boxes, but I do not see any examples of input fields ....

How can I do it?

(using Visual Studio 6.0 in C ++)

Thanks.

+4
source share
4 answers

I know this is often required, but there is no built-in input window in MFC, so you have to create your own. Usually I just create a simple dialog with a shortcut and an edit field (the dialog already goes with the OK / Cancel buttons), then create a class, say CInputDlg , add member variables for the shortcut and edit field and just call it like any other dialog:

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

You need to create a dialog box and place an edit control on it. There is no automatic solution. You must encode it or find the code on the Internet.

+3
source

When you created the MFC application, what type of project did you indicate to the wizard to create? I usually use my Dialog application, and then just the question of placing the text box in the dialog box.

+1
source

In Visual Studio 2008, this is simple:

  • In the resource view, right-click on the Dialog directory and select add resource ... or insert a dialog (select this option, you are not of course what dialogue).
  • Click on the tools and add static text and Edit Control and any tools you want to add, enter the dialog box name and class name, this will add the header file and .cpp file to your project directly.
  • Add the controls you want to add to your class
0
source

All Articles