开发者

C# Block mouse movement [duplicate]

This q开发者_JAVA技巧uestion already has answers here: Closed 12 years ago.

Possible Duplicates:

how to Make the Mouse Freeze c#

How can I block keyboard and mouse input in C#?

I'm making a mouse macro program, and I already have the core mostly worked out. It would be nice, though, if I could temporarily block the user from using the mouse while the macro is playing... is this possible in C#?


EDIT

This code works perfectly for me:

    [DllImport("user32.dll")]
    private static extern bool BlockInput(bool block);

    public static void FreezeMouse()
    {
        BlockInput(true);
    }

    public static void ThawMouse()
    {
        BlockInput(false);
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜