0

I am able to lock the Windows screen on Button_Click event by calling LockWorkStation(); How can I unlock the Windows screen?

Is there any way I can unlock screen maybe after 10 seconds or something? I have the credentials for windows login. Please suggest.

Below is the code that I have written so far in MainWindow.xaml.cs.

using System.Runtime.InteropServices;
namespace UnlockApp
{
    
    public partial class MainWindow : Window
    {
        [DllImport("user32")]
        public static extern void LockWorkStation();
        public MainWindow()
        {
            InitializeComponent();
        }
private void Button2_Click(object sender, RoutedEventArgs e)
        {
            LockWorkStation();
        }
    }
}

0 Answers0