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.
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;
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.