訊息篩選器/螢幕無操作鎖屏

web男發表於2024-03-22

#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

相關文章