using System.Runtime.InteropServices;
 
[DllImport("User32.DLL")]
public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam); 

private void button1_Click(object sender, EventArgs e)
{
    const int WM_SYSCOMMAND = 0x0112;
    const int SC_MONITORPOWER = 61808; 
    SendMessage(Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 2);  //最后那个数字含义:2代表关闭显示器;-1代表打开显示器
}
posted on 2009-10-11 08:48  lxcsmallcity  阅读(307)  评论(0编辑  收藏  举报