Pop-up for input?

I'm just messing around with using classes and message boxes, and decided to make program only using pop-ups. How would I make a pop-up like a message box that takes in text input?
Last edited on
Which operating system?
Hello moosyman,

I do not think the operating system is as important as: is this a windows program ot a console program?

If it is a console program do you have an idea of what this pop up message will look like?

Once you deal with how the message box will look then it is just a matter of putting in your questions and getting th answers.

For a start you might find this function useful:

1
2
3
4
5
void GotoXY(short x, short y)
{
	COORD p = { y, x };
	SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), p);
}


I also have a unction that puts a double line box around a single line of text that could be adjusted for what you might need.

Hope that helps,

Andy
This is a console program. I guess I can show some code to give an idea of what I'm trying to create.

Game::Game()
{
Intro();
}

void Game::Intro()
{
MessageBox(NULL, TEXT("Hello, and welcome to your new game. Please give your name."), TEXT("This also isn't final."), MB_OK);
ChooseName();
}

void Game::ChooseName()
{
std::getline(std::cin, PlayerName);
char buff[100];
sprintf_s(buff, "So you're happy with your name being this: %s", PlayerName.c_str());
int MsgBoxID = MessageBox(NULL, buff, TEXT("Just checking if you wanna keep it."), MB_YESNO);
switch (MsgBoxID)
{
case IDYES:
MessageBox(NULL, TEXT("I liked that name anyways."), TEXT("One final precaution."), MB_OK);
break;
case IDNO:
MessageBox(NULL, TEXT("Time for you to choose another name, then."), TEXT("Here's another chance."), MB_OK);
ChooseName();
}
}

void Game::ChooseClass()
{
MessageBox(NULL, TEXT("Now, what class would you like to take on? Would you like to be a Knight, Archer, Wizard, Summoner, Legionist, or Trapper?"), TEXT("Important decision."), MB_OK);
}

I started off replacing cin with the sprintf_s, but I want to go further and make a pop-up like the MessageBox that takes in a string so they can type out what class they want.
Thank you, I just wanna make it regardless of difficulty.
Topic archived. No new replies allowed.