노트북 도난방지 0930

2008. 9. 30. 23:08
private void ScreenSaver_FormClosing(object sender, FormClosingEventArgs e)
{

e.Cancel = true;
base.OnClosing(e);
}

AlT+F4, ALT+TAB, CTLR + ESC, Windows 키를 막으려고 이리저리 검색했는데
FormClosing 이벤트로 Alt+F4 가 안막히게 구현하는 방법을 찾았다.
원래 내가 의도한건 키보드 키 자체를 안먹히게 하는거였는데.

이제 나머지 다른 키들을 인식안되게 하려고 하다가
어느 외국 사이트에서 Alt+Tab에 관한 소스를 찾았다.
그래서 신나게 소스 적용하고보니...
ALT+Tab 을 막은게 아니라 AlT+Tab 했을때 나오는 아이콘들 중에
내가 지정한 프로그램의 아이콘이 안나오게 하는 소스였다 -_-

[DllImport("user32.dll")] public static extern int SetWindowLong(IntPtr window, int index, int value); [DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr window, int index); const int GWL_EXSTYLE = -20; const int WS_EX_TOOLWINDOW = 0x00000080; const int WS_EX_APPWINDOW = 0x00040000;


//Calling after InitializeComponent, or form load events int windowStyle = GetWindowLong(this.Handle, GWL_EXSTYLE);
SetWindowLong(this.Handle, GWL_EXSTYLE, windowStyle | TOOLWINDOW);


휴우 빨리 키 막기 기능 넣고나서
다음 기능들을 추가해야하는데 ㅠ_ㅠ
늘 삽질의 연속이군하~

박상근 프로그래밍/Laptop Guard