Hi!
Does anybody know any way to display a messagebox showing a standard message with a "Don't show again this message" check box?
I know that standard MessageBox does not provide this feature and wouldn't like to create a standard form for that because I will have to reimplement many other features like icons, localized buttons etc.
Any ideas? I remember that such things could be done using win32 API back in vb6. | | papadi Saturday, April 15, 2006 3:52 PM | Usually people just create a new Form, that looks like a message box, with a check box control on it and use that instead of MessageBox.Show. | | Peter Ritchie Sunday, April 16, 2006 1:49 PM | I'm not aware of a way to this even with win32 api. Theoretically you can add any control to any form but in this case the problem is that MessageBox are modal so the Show method won't return until a button is pressed. If a message box would be displayed using something like CreateMessageBox and thenShowMessageBox you could modify the form between those two calls but there's nothing like this in .NET or Win32.
Personally I did my own message boxes because it's not a big deal and I have more flexibility. Not to mention that the MessageBox.Show method has way too many parameters ... . | | Mike Danes Sunday, April 16, 2006 7:59 AM | Usually people just create a new Form, that looks like a message box, with a check box control on it and use that instead of MessageBox.Show. | | Peter Ritchie Sunday, April 16, 2006 1:49 PM | If we create a custom dialog, we won't have easy access to the system icons for error, exclamation, question, etc. How can I access those icons from a custom dialog?
| | flipdoubt Monday, July 24, 2006 6:24 PM | | flipdoubt wrote: | If we create a custom dialog, we won't have easy access to the system icons for error, exclamation, question, etc. How can I access those icons from a custom dialog?
|
|
Use the SystemIcons class, it has static fields for Error, Exclamation, Question, etc. | | Peter Ritchie Monday, July 24, 2006 7:09 PM | Just noticed this goodie: SHMessageBoxCheck functionthat you can Platform Invoke. From MSDN: | Displays a message box that gives the user the option of suppressing further occurrences. If the user has already opted to suppress the message box, the function does not display a dialog box and instead simply returns the default value. |
|
The DllImport declaration from PInvoke.net:
[DllImport("shlwapi.dll", EntryPoint = "#185", ExactSpelling = true, PreserveSig = false)]
public static extern int SHMessageBoxCheck (
[In] IntPtr hwnd,
[In] String pszText,
[In] String pszTitle,
[In] MessageBoxCheckFlags uType,
[In] int iDefault,
[In] string pszRegVal
); | | Peter Ritchie Wednesday, July 26, 2006 4:26 AM |
|