using System.Runtime.InteropServices; // using 추가 |
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; |
// 모니터 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); |
// 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 |
SendMessage(this.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF);
// 모니터 OFF
SendMessage(this.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_ON);
// 모니터 ON