老刘1号 当前离线
论坛巡查
TOP
pcl_test 当前离线
荣誉版主
/*&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.");} } } }复制代码
评分人数
#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 }复制代码
CrLf 当前离线