消息筛选器/屏幕无操作锁屏

#region 系统锁屏
[DllImport("user32")]
public static extern bool LockWorkStation();//调用LockWorkStation()锁屏
#endregion

 

#region 消息筛选器
internal class MessageFilter : IMessageFilter
{
    public bool PreFilterMessage(ref Message m)
    {
        if(m.Msg==0x0200 || m.Msg==0x0201 ||m.Msg==0x0204 ||m.Msg==0x0207)
        { CommonMethods.TickCount = 0; }//键盘鼠标有操作清空计数,tickCount为定时器循环次数
        return false;
    }
}

#endregion

 
 
 
posted @ 2024-03-22 00:05  web男  阅读(1)  评论(0编辑  收藏  举报