老刘1号 当前在线
论坛巡查
2017.6.24更新了版本,使用NET2.0重新编译,增强了兼容性 2017.6.3更新了版本,对PCL斑竹的C#源代码做了略微修改,体积精简到3KB,压缩后不足1.2KB。用法更为简便,直接Start即可。 如果不使用Taskkill结束,将会在一天后自动关闭 2017.5.2更新了版本,可以随时控制开关,无需计时控制,更加灵活
using System; using System.Threading; using System.Runtime.InteropServices; class BlockUserInput { [DllImport("user32.dll")] static extern bool BlockInput(bool BlockIt); static void Main(string[] args) { BlockInput(true); Thread.Sleep(24*60*60*1000); } }复制代码
START /min BlockUserInput PING Baidu.cn -n 10 Taskkill /f /im BlockUserInput.exe复制代码
TOP
CrLf 当前离线
评分人数
pcl_test 当前离线
荣誉版主
#NoEnv #NoTrayIcon if A_OSVersion in WIN_8,WIN_8.1 { MsgBox ,,提示,暂不支持Win8及以上系统,10 ExitApp } Else { BlockInput,On ;由于 Windows API 的特性,按下 Ctrl+Alt+Del 将重新启用输入 sleep,%1%000 BlockInput,Off }复制代码
/*&cls @echo off set "netpath=%systemroot%\Microsoft.NET\Framework" for /f "delims=" %%a in ('dir /ad /b "%netpath%\v?.*"') do ( if exist "%netpath%\%%a\csc.exe" ( set "cscpath=%netpath%\%%a\csc.exe" goto :0 ) ) echo;未安装.Net Framework 2.0及其上版本组件或相关程序丢失&pause&exit/b :0 "%cscpath%" /out:"$BlockInput.exe" "%~f0" "$BlockInput.exe" pause&exit */ using System; using System.Threading; using System.Runtime.InteropServices; class BlockUserInput { [DllImport("user32.dll")] static extern bool BlockInput(bool BlockIt); static void Main(string[] args) { if(args.Length<1){ Console.WriteLine("Blocks keyboard and mouse input events.\r\n"+ "Usage:\r\n$BlockInput.exe seconds //The valid range is 0 ~ 86400."); Thread.Sleep(2000); }else{ try{ int num = Convert.ToInt32(args[0].ToString()); if(num>=0 && num<=86400){ Console.WriteLine("Blocking..."); BlockInput(true); Thread.Sleep(num*1000); }else Console.WriteLine("Input out of range."); }catch{Console.WriteLine("Enter an integer between 0 and 86400.");} } } }复制代码
dingcool 当前离线
列兵
Nsqs 当前离线
少尉