locked
C# BlockInput, mouse and keyboard RRS feed

  • Question

  • Hi everyone!!

    im working for in a school proyect in i need to put in disable my mouse and keyboard, i read a loot of blogs and i found the same solution, the problem is that doesnt work here it is:

    //declare this
    using System.Runtime.InteropServices;

    [return
    : MarshalAs(UnmanagedType.Bool)]
    [DllImport(" user32.dll" , CharSet = CharSet.Auto, ExactSpelling = true )]
    public static extern void BlockInput([In, MarshalAs(UnmanagedType.Bool)]bool fBlockIt);

    private
     void
     button1_Click(object
     sender, EventArgs e)
    {
    BlockInput(true );

    }


    i have a windows 7 laptop, a microsoft visual studio 2008
    Thanks!!!
    Tuesday, October 5, 2010 3:53 AM