BLOG main image
분류 전체보기 (68)
excel.101 (0)
rewind (9)
(3)
(2)
목공 (3)
(3)
me2day (0)
The Ethereal Void (9)
코드 (14)
귀찮은것 (0)
Visitors up to today!
Today hit, Yesterday hit
daisy rss
tistory 티스토리 가입하기!
2007. 8. 8. 11:05
System Wake-up Events

원래의 목적은 SetSuspendState를 통해 Standby 상태로 진입시켜 놓고 Wake up Event를 발생시켜 활성상태로 복귀시키는 것이 목적이었다. MSDN에서는 Waitable timer를 통해 이러한 과정을 진행시키는 내용을 명기해 놓았고, 몇몇 자료에서 .NET 환경에서 Waitable timer는 System.Threading.Timer와 대응하기 때문에 이를 통해 Wake up Event를 발생시킬수 있다고 나와있으나, System.Threading.Timer도 API의 Waitable timer도 Standby 상태에서 자동으로 활성상태로 복귀시켜주지 않았다.

일단 주 목적은 모니터를 끄는 것이었기 때문에, 시간 관계상 SendMessage를 통해 모니터를 제어하는 수준에서 처리 하였다.
const int WM_SYSCOMMAND = 0x0112;
const int SC_MONITORPOWER = 0xF170;

const int MONITOR_ON = -1;
const int MONITOR_OFF = 2;
const int MONITOR_STANBY = 1;

[DllImport("user32.dll")]
private static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);

/* ... Turn Off ... */

SendMessage(this.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF);

반응형