comparison ServerMonitor/Win32Helpers.cs @ 17:68d7834dc28e

More comments.
author Brad Greco <brad@bgreco.net>
date Sat, 25 May 2019 15:14:26 -0400
parents 052aa62cb42a
children 7645122aa7a9
comparison
equal deleted inserted replaced
16:7626b099aefd 17:68d7834dc28e
1 using System; 1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Runtime.InteropServices; 2 using System.Runtime.InteropServices;
5 using System.Text;
6 using System.Threading.Tasks;
7 using System.Windows.Forms; 3 using System.Windows.Forms;
8 4
9 namespace ServerMonitorApp 5 namespace ServerMonitorApp
10 { 6 {
7 /// <summary>Methods for interacting with the Win32 API.</summary>
11 class Win32Helpers 8 class Win32Helpers
12 { 9 {
13 [DllImport("user32.dll")] 10 [DllImport("user32.dll")]
14 [return: MarshalAs(UnmanagedType.Bool)] 11 [return: MarshalAs(UnmanagedType.Bool)]
15 static extern bool FlashWindowEx(ref FLASHWINFO pwfi); 12 static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
63 /// Flash continuously until the window comes to the foreground. 60 /// Flash continuously until the window comes to the foreground.
64 /// </summary> 61 /// </summary>
65 FLASHW_TIMERNOFG = 12 62 FLASHW_TIMERNOFG = 12
66 } 63 }
67 64
65 /// <summary>Flashes a window icon in the taskbar.</summary>
66 /// <param name="form">The form to flash.</param>
68 public static bool FlashWindowEx(Form form) 67 public static bool FlashWindowEx(Form form)
69 { 68 {
70 IntPtr hWnd = form.Handle; 69 IntPtr hWnd = form.Handle;
71 FLASHWINFO fInfo = new FLASHWINFO(); 70 FLASHWINFO fInfo = new FLASHWINFO();
72 71
77 fInfo.dwTimeout = 0; 76 fInfo.dwTimeout = 0;
78 77
79 return FlashWindowEx(ref fInfo); 78 return FlashWindowEx(ref fInfo);
80 } 79 }
81 80
81 /// <summary>Stops flashing a window icon in the taskbar.</summary>
82 /// <param name="form">The form to stop flashing.</param>
82 public static bool StopFlashWindowEx(Form form) 83 public static bool StopFlashWindowEx(Form form)
83 { 84 {
84 IntPtr hWnd = form.Handle; 85 IntPtr hWnd = form.Handle;
85 FLASHWINFO fInfo = new FLASHWINFO(); 86 FLASHWINFO fInfo = new FLASHWINFO();
86 87