2024 WinUI3
you can use below to solve
CoreWindow 另请参阅下面的实现 IInitializeWithWindow 的类部分。 请勿使用 GetKeyState 方法,而改为使用 WinUI 3 提供的 InputKeyboardSource.GetKeyStateForCurrentThread 方法。
so....
var ctrlState = InputKeyboardSource.GetKeyStateForCurrentThread(Windows.System.VirtualKey.Control);