这是一个触摸板虚拟键盘按钮。当我按屏幕上的“TOUCH”时,将显示“ab”。我正在尝试使用 BlockInput 在按下 TOUCH 按钮后 2 秒内阻止鼠标和键盘的任何输入。但它不起作用,我认为需要为 BlockInput 设置一个计时器,any1 知道该怎么做吗?这是我的代码:
public partial class TRY
    {
        [System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "BlockInput")]
        [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
        public static extern bool BlockInput([System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] bool fBlockIt);
    }
public void TOUCH(string key)
    {  
        if (key == "Press")
        {
            PressAndRelease("a");
            PressAndRelease("b");
            ReleaseKeys();
            TRY.BlockInput(true);
            Thread.Sleep(2000);
            TRY.BlockInput(false);
        }
    }