태그 보관물: 모니터 ON OFF

C# 모니터 On OFF 처리

using System.Runtime.InteropServices;  //  using 추가
	// 모니터 On/Off 관련  선언 
	public  int WM_SYSCOMMAND = 0x0112;
	public int SC_MONITORPOWER = 0xF170;
	const int MONITOR_ON = -1;
	const int MONITOR_OFF = 2;
	const int MONITOR_STANBY = 1;
        // dll 참조 
	[DllImport("user32.dll")]   
	private static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);
	SendMessage(this.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF); 
        // 모니터 OFF
	SendMessage(this.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_ON);
        // 모니터 ON