Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I need to disable keyboard/mouse or both for specific time period at system level in my application.

I have following to do that
C#
public partial class NativeMethods
        {

            /// Return Type: BOOL->int
            ///fBlockIt: BOOL->int
            [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);

        }


By this code the task is complete but when user click on CTRL+ALT+DELETE keyboard and mouse are working again.
Can any body tell me how to stop this??
Posted
Updated 17-Dec-12 2:04am
v2
Comments
Tarun Mangukiya 18-Dec-12 0:40am    
I gave the same answer...
Hetal Jariwala 18-Dec-12 1:30am    
ok???

Have you tried Keyboard and Mouse hook?

But I think that you can't stop using CTRL+ALT+DELETE.
It's universal...

Thanks.
 
Share this answer
 
Please read the link How can I block keyboard and mouse input in C#?[^].

This will help.
 
Share this answer
 
v2
Comments
Hetal Jariwala 18-Dec-12 0:33am    
tnx
Hi,

Refer this link...

disable mouse click event system wide using C#?

this may help you.

Thanks
 
Share this answer
 
Comments
Hetal Jariwala 18-Dec-12 0:33am    
tnx
[no name] 18-Dec-12 4:23am    
Yours welcome...

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