Display error message dialog box (MessageBox) only with Close or Cancel buttons?

I read in “Windows Best Practices: Error Messages” that “OK” is the wrong button to display in the error dialog.

... enter the close button. Do not use OK for error messages , as this wording implies that the problems are in order.

So, how can I display a simple error dialog with a single Close / Cancel button?

Is it possible with the standard MessageBox class, or should I refer to a custom dialog (or library) or another Win32 / p message - call "hacks"?

(There is no value in the MessageBoxButtons section.)

Thanks.

+6
source share
1 answer

You want a fully improved TaskDialog .

Available here with usage description here

TaskDialog allows you to specify in more detail the buttons and icons that show, and - Microsoft's own solution for your .Net problem.

- update answer @pst comment

If you need to support Winows XP or earlier, there is a very stable and reliable codeproject library that wraps and emulates the taskdialog class for Microsoft when you use an earlier version of Windows and use your own version of MS if you are in Vista or later.

I relied on this codeproject library about 2 years ago, and then it was stable, so there should not be any security problems at all.

+7
source

Source: https://habr.com/ru/post/907081/


All Articles