-
-
Couldn't load subscription status.
- Fork 38
Open
Description
protected override void OnSourceInitialized(EventArgs e)
{
var windowInteropHelper = new WindowInteropHelper(this);
var hwnd = windowInteropHelper.Handle;
var devices = RawInputDevice.GetDevices();
RawInputDevice.RegisterDevice(HidUsageAndPage.TouchScreen,
RawInputDeviceFlags.ExInputSink | RawInputDeviceFlags.DevNotify, hwnd);
RawInputDevice.RegisterDevice(HidUsageAndPage.TouchPad,
RawInputDeviceFlags.ExInputSink | RawInputDeviceFlags.DevNotify, hwnd);
RawInputDevice.RegisterDevice(HidUsageAndPage.Pen,
RawInputDeviceFlags.ExInputSink | RawInputDeviceFlags.DevNotify, hwnd);
HwndSource source = HwndSource.FromHwnd(hwnd);
source.AddHook(WndProc);
}
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
switch (msg)
{
case 0x00FF:
{
ProcessInputCommand(lParam);
break;
}
}
handled = false;
return IntPtr.Zero;
}
Regardless of the triggering position, whenever focusing on the "Start Menu" in the system, the msg no longer receives the 0x00FF signal. Whether it's TouchScreen, TouchPad, or Pen, the issue persists. This has been bothering me for a long time. I would like to ask how to solve this problem, so that even when focusing on the "Start Menu" in the system, I can still receive the correct WM_INPUT signals. Thank you.
*My system is win11
Metadata
Metadata
Assignees
Labels
No labels