Is there any way to recognize if login screen is displayed ?
I trued to use OpenInputDesktop function but it not reliable (sometime it works but sometimes not)
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr OpenInputDesktop(uint dwFlags, bool fInherit, uint dwDesiredAccess);
var handle = OpenInputDesktop(0, false, 0);
var locked = handle == null || handle == 0;
My exact case is: Windows 10 starts all previously ran programs with user session after OS reboot. I dont want my program to do anything until Windows login screen is displayed / user unlock his session