Mercurial > servermonitor
comparison ServerMonitor/Win32Helpers.cs @ 39:7645122aa7a9
Get it working under Mono
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Tue, 09 Jun 2020 20:59:00 -0400 |
parents | 68d7834dc28e |
children |
comparison
equal
deleted
inserted
replaced
38:8ab98a803d39 | 39:7645122aa7a9 |
---|---|
20 public UInt32 uCount; | 20 public UInt32 uCount; |
21 public UInt32 dwTimeout; | 21 public UInt32 dwTimeout; |
22 } | 22 } |
23 | 23 |
24 public const int HWND_BROADCAST = 0xffff; | 24 public const int HWND_BROADCAST = 0xffff; |
25 public static readonly int WM_SHOWMONITOR = RegisterWindowMessage("WM_SHOWMONITOR"); | 25 |
26 #if __MonoCS__ | |
27 public static readonly int WM_SHOWMONITOR = -12345; | |
28 #else | |
29 public static readonly int WM_SHOWMONITOR = RegisterWindowMessage("WM_SHOWMONITOR"); | |
30 #endif | |
31 | |
26 [DllImport("user32")] | 32 [DllImport("user32")] |
27 public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam); | 33 public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam); |
28 [DllImport("user32")] | 34 [DllImport("user32")] |
29 public static extern int RegisterWindowMessage(string message); | 35 public static extern int RegisterWindowMessage(string message); |
30 | 36 |
31 public enum FlashWindowFlags : uint | 37 public enum FlashWindowFlags : uint |
32 { | 38 { |
33 /// <summary> | 39 /// <summary> |
34 /// Stop flashing. The system restores the window to its original state. | 40 /// Stop flashing. The system restores the window to its original state. |
35 /// </summary> | 41 /// </summary> |
36 FLASHW_STOP = 0, | 42 FLASHW_STOP = 0, |
37 | 43 |
38 /// <summary> | 44 /// <summary> |
39 /// Flash the window caption | 45 /// Flash the window caption |
40 /// </summary> | 46 /// </summary> |
64 | 70 |
65 /// <summary>Flashes a window icon in the taskbar.</summary> | 71 /// <summary>Flashes a window icon in the taskbar.</summary> |
66 /// <param name="form">The form to flash.</param> | 72 /// <param name="form">The form to flash.</param> |
67 public static bool FlashWindowEx(Form form) | 73 public static bool FlashWindowEx(Form form) |
68 { | 74 { |
75 if (Helpers.IsMono()) { | |
76 return false; | |
77 } | |
78 | |
69 IntPtr hWnd = form.Handle; | 79 IntPtr hWnd = form.Handle; |
70 FLASHWINFO fInfo = new FLASHWINFO(); | 80 FLASHWINFO fInfo = new FLASHWINFO(); |
71 | 81 |
72 fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); | 82 fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); |
73 fInfo.hwnd = hWnd; | 83 fInfo.hwnd = hWnd; |
80 | 90 |
81 /// <summary>Stops flashing a window icon in the taskbar.</summary> | 91 /// <summary>Stops flashing a window icon in the taskbar.</summary> |
82 /// <param name="form">The form to stop flashing.</param> | 92 /// <param name="form">The form to stop flashing.</param> |
83 public static bool StopFlashWindowEx(Form form) | 93 public static bool StopFlashWindowEx(Form form) |
84 { | 94 { |
95 if (Helpers.IsMono()) { | |
96 return false; | |
97 } | |
98 | |
85 IntPtr hWnd = form.Handle; | 99 IntPtr hWnd = form.Handle; |
86 FLASHWINFO fInfo = new FLASHWINFO(); | 100 FLASHWINFO fInfo = new FLASHWINFO(); |
87 | 101 |
88 fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); | 102 fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); |
89 fInfo.hwnd = hWnd; | 103 fInfo.hwnd = hWnd; |