Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Input? 1

Status
Not open for further replies.

noaaprogrammer

Programmer
May 4, 2001
36
US
Is there anything in Visual C++ like the input box in Visual Basic? I need something like the AfxMessageBox to prompt the user and allow them to enter a string.
 
Well, I have to admit that I'm a little foggy on what exactly you are asking for, but you should be able to create a simple dialog box to accomplish what you need.

-Create a dialog with a edit box in resources
-Use classwizard to derive a class for the dialog
-Use classwizard to attach a CString object to the edit box
-Call the dialog box with MyDlgBox.DoModal();
-Get the input by accessing the class member MyDlgBox.MyString

Example code:
CGetInputDlg MyDlgBox;
CString sUserInput;

MyDlgBox.DoModal();
sUserInput = MyDlgBox.MyString;

There might be a more elegant way of doing it though. I'm still fairly new to the UI portion of VC++
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top