public static MessageBoxResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton button, MessageBoxModal modal)
 {
     return((MessageBoxResult)MessageBoxA(IntPtr.Zero, text, caption, ((uint)buttons) | ((uint)icon) | ((uint)button) | ((uint)modal)));
 }
Example #2
0
        /// <summary>
        /// Shows A Simple MessageBox.
        /// </summary>
        /// <param name="text">The Main Text In The MessageBox.</param>
        /// <param name="caption">The Title Text In The MessageBox.</param>
        /// <param name="buttons">The Buttons To Show In The MessageBox.</param>
        /// <param name="icon">The Icon To Show In The MessageBox.</param>
        /// <param name="button">The Button Pre-Selected By Default Upon The MessageBox Showing (Left To Right).</param>
        /// <param name="modal">The modality of the MessageBox.</param>
        /// <param name="TopMost">Whether To Force This MessageBox On Top Of Anything It Can.</param>
        /// <returns>The Result Indicating What Button Was Pressed</returns>
        public static MessageBoxResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton button, MessageBoxModal modal, bool TopMost = false)
        {
            var Buttons = (uint)buttons;

            if (TopMost)
            {
                Buttons |= MB_TOPMOST;
                Buttons |= MB_SETFOREGROUND;
            }

            return((MessageBoxResult)MessageBoxA(IntPtr.Zero, text, caption, (Buttons) | ((uint)icon) | ((uint)button) | ((uint)modal)));
        }