using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows; using System; using System.Net; using System.Net.Sockets; using System.Threading; namespace HKHelper { public class TelevisionStart { public static bool TurnOn() { return SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1) != 0; } public static bool TurnOff() { return SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2) != 0; } [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam); private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff); private const uint WM_SYSCOMMAND = 0x0112; private const int SC_MONITORPOWER = 0xf170; } }