Click here to Skip to main content
15,063,166 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

i have the API for both lock and unlock the mouse and keyboard simultaneously.

The API is :


But i need separately lock and unlock of those thing.. Is Any API Available for that..

I would say doing it separately cannot make any practical sense. Can you prove me wrong?

1 solution

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)
kerkenez2000 6-Oct-12 3:51am
Why not work or not activated c# Blockinput Fuunction on windows service.

Blockinput function works as runas admin but I do not want to ask each work.
So I wrote this application as a service and on blockinput service is not activated

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900