-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMessageBox.cs
More file actions
74 lines (66 loc) · 2.09 KB
/
Copy pathMessageBox.cs
File metadata and controls
74 lines (66 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Runtime.InteropServices;
namespace SystemMessageBoxCSharp
{
public class MessageBoxUtils
{
[DllImport("User32.dll", CharSet = CharSet.Unicode)]
private static extern int MessageBox(IntPtr nWnd, string text, string title, uint type);
public static MessageBoxResult Show(string text, string title, uint type)
{
return (MessageBoxResult)MessageBox(IntPtr.Zero, text, title, type);
}
public enum MessageBoxButtons
{
MB_OK = 0,
MB_OKCANCEL = 0x01,
MB_ABORTRETRYIGNORE = 0x02,
MB_YESNOCANCEL = 0x03,
MB_YESNO = 0x04,
MB_RETRYCANCEL = 0x05,
MB_CANCELTRYCONTINUE = 0x06,
MB_HELP = 0x4000,
}
public enum MessageBoxIcon
{
MB_ICONERROR = 0x10,
MB_ICONQUESTION = 0x20,
MB_ICONEXCLAMATION = 0x30,
MB_ICONINFORMATION = 0x40
}
public enum MessageBoxDefaultButton
{
FirstButton = 0,
SecondButton = 0x100,
ThirdButton = 0x200,
FourthButton = 0x300
}
public enum MessageBoxBehaviour
{
LockOnlyMainThread = 0,
LockOnlyMainThreadTopMost = 0x1000,
LockAllThreadsIfNULL = 0x2000
}
public enum MessageBoxDisplaySettings
{
SetForeground = 0x10000,
OnlyReturnIfOnDesktop = 0x20000,
TopMost = 0x40000,
RightJustifiedText = 0x80000,
RightToLeftHebrewArabicText = 0x100000,
ServiceNotification = 0x200000, //The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
}
public enum MessageBoxResult
{
OK = 1,
Cancel = 2,
Abort = 3,
Retry = 4,
Ignore = 5,
Yes = 6,
No = 7,
TryAgain = 10,
Continue = 11
}
}
}