Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a conventional/standard way to create an MFC error dialog?

I'd like to create a dialog for my application that shows a message and displays the standard red circle with the white "x" in the middle; seems to me this is a pretty standard windows dialog. I'm somewhat new to MFC, so I don't know if there's a short-cut to do this other than creating a dialog resource, copying the image of the red x from microsoft's best practices page, including that as a dialog item and then coding up my own. Surely there is a more standard way to do this?

like image 921
Mike Caron Avatar asked May 12 '11 20:05

Mike Caron


2 Answers

AfxMessageBox(_T("Something bad happened!"), MB_OK | MB_ICONSTOP);

See also AfxMessageBox.

like image 86
Dave Rager Avatar answered Nov 20 '22 09:11

Dave Rager


If the user can take corrective action about the error and you are targeting Windows Vista or higher, you can use CTaskDialog. This lets you present the new "Task Dialog" with large action buttons. Here's a tutorial, and the MSDN page.

enter image description here

like image 27
Aidan Ryan Avatar answered Nov 20 '22 09:11

Aidan Ryan