0

Hello, I was wondering how I would code for a box that prompts the user in a sort of, windows style error message format.

Thanks.

2
Contributors
1
Reply
9
Views
9 Years
Discussion Span
Last Post by mitrmkar
0

Try this one, it displays four different styles messages, maybe you get the idea of how message boxes work. The last one prompts you with a question.

#include <windows.h>
int main(int argc, char* argv[])
{
	MessageBox(NULL, "Serious error", "<Message title here>", MB_ICONSTOP|MB_SETFOREGROUND);
	MessageBox(NULL, "Warning", "<Message title here>", MB_ICONEXCLAMATION|MB_SETFOREGROUND);
	MessageBox(NULL, "Info", "<Message title here>", MB_ICONINFORMATION|MB_SETFOREGROUND);

	if(IDYES == MessageBox(NULL, "Click Yes or No", 
		"<Message title here>", 
		MB_ICONQUESTION|MB_YESNO|MB_SETFOREGROUND))
	{
		MessageBox(NULL, "You clicked Yes", 
			"<Message title here>", 
			MB_ICONINFORMATION|MB_SETFOREGROUND);
	}
	else
	{
		MessageBox(NULL, "You clicked  No", 
			"<Message title here>", 
			MB_ICONINFORMATION|MB_SETFOREGROUND);
	}
	return 0;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.