Mike Caron
Mike Caron

Reputation: 5784

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?

Upvotes: 5

Views: 5103

Answers (2)

Dave Rager
Dave Rager

Reputation: 8160

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

See also AfxMessageBox.

Upvotes: 13

Aidan Ryan
Aidan Ryan

Reputation: 11607

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

Upvotes: 7

Related Questions