private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
        {
            // 检查硬件设备插拔。
            if (msg == (int)WindowMessages.DEVICECHANGE)
            {
                Log(DeviceChangeListenerTextBlock, $"设备发生插拔 0x{wparam.ToString("X4")} - 0x{lparam.ToString("X4")}", true);
                LogDevices();
            }
            else if (msg == (int)WindowMessages.TABLET_ADDED)
            {
                Log(DeviceChangeListenerTextBlock, $"触摸设备插入 0x{wparam.ToString("X4")} - 0x{lparam.ToString("X4")}", true);
            }
            else if (msg == (int)WindowMessages.TABLET_DELETED)
            {
                Log(DeviceChangeListenerTextBlock, $"触摸设备拔出 0x{wparam.ToString("X4")} - 0x{lparam.ToString("X4")}", true);
            }

            // 输出消息。
            if (UnnecessaryMsgs.Contains(msg))
            {
                return(IntPtr.Zero);
            }

            var formattedMessage = $"{(WindowMessages)msg}";

            Log(HwndMsgTextBlock, formattedMessage);

            return(IntPtr.Zero);
        }
        private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
        {
            // 检查硬件设备插拔。
            var isDeviceChanged = msg == 537;

            if (isDeviceChanged)
            {
                Log(DeviceChangeListenerTextBlock, $"设备发生插拔 0x{wparam.ToString("X4")} - 0x{lparam.ToString("X4")}", true);
            }

            // 输出消息。
            if (UnnecessaryMsgs.Contains(msg))
            {
                return(IntPtr.Zero);
            }

            var formattedMessage = $"{(WindowMessages)msg}";

            Log(HwndMsgTextBlock, formattedMessage);

            return(IntPtr.Zero);
        }