0

これはタッチパッドの仮想キーボード ボタンです。画面の「TOUCH」を押すと「ab」が表示されます。TOUCH ボタンを押した直後に、BlockInput を使用してマウスとキーボードの入力を 2 秒間防止しようとしています。しかし、それは機能しません。BlockInput のタイマーを設定する必要があると思います。その方法を知っている人はいますか? これが私のコードです:

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);
        }
    }
4

1 に答える 1