We help IT Professionals succeed at work.

Screen lock/unlock

Hi,

I need to check if screen is locked, then unlock it and if it is unlock then lock it. How can I do it using c#?

Thank you
Comment
Watch Question

Author

Commented:
thank luc_roy for reply.

But, it is 100% different than I am asking; I am asking screen lock of mobile!!!!!!!!!!!!!!!!!

Author

Commented:
SHDeviceLockAndPrompt() feature has a precondition that the feature should be enabled from Settings > Lock with a password and idle time setting.

How can I handle it? I need to enable it via programming too.

Thanks
if theres no password then the screen is not going to lock.