简体   繁体   中英

Display error dialog (MessageBox) with Only “Close” or “Cancel” buttons?

I read in Windows Experience Guidelines: Error Messages that "OK" is an incorrect button to display on an error dialog.

...provide a Close button. Don't use OK for error messages , because this wording implies that problems are OK.

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

Is this possible with the standard MessageBox class or must I resort to custom dialog (or library) or other Win32 message / p-invoke "hacks"?

(There doesn't seem to be anything relevant in the MessageBoxButtons enumeration.)

Thanks.

You want the all-improved TaskDialog .

Available from here with description on usage here

TaskDialog allows you to specify in more detail the buttons and icons that show and is microsoft's own solution to your problem in .Net.

-- update to answer @pst's comment

If you have to support Winows XP or earlier then there is a very stable and reliable library on codeproject which wraps and emulates the microsoft taskdialog class when you are using an earlier version of windows, and uses MS's own version if you are on Vista or later.

I have relied on this codeproject library approx 2 years ago, and it was stable then, so there should be no reliability issues at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM