c# - 指示 KeyPress 是否来自 SIP,而不是硬按钮

标签 c# compact-framework

我们遇到一种情况,硬件返回按钮执行特定操作,但是使用 SIP 控件上的返回按钮也会触发此操作。

是否有办法确定 KeyPressEventArg 是否来自 SIP?

    /// <summary>
    /// Handles the Enter button being pressed as navigation to complete the signature capture
    /// </summary>
    /// <param name="e">The key event args to quaify what button was pressed.</param>
    public override void HandleKeyPress(KeyPressEventArgs e)
    {
        if (e.KeyChar == '\r') // and is not SIP '\r'
        {
            // need to handle only hard button not SIP
        }
    }

非常感谢您对此的任何启发

最佳答案

好的,找到了一种方法来做到这一点,但是我觉得这可能不兼容所有设备类型。

        public void WndProc(ref Microsoft.WindowsCE.Forms.Message m)
        {
            if (m.Msg == WM_KEYDOWN && (m.WParam == (IntPtr)VK_RETURN && m.LParam != (IntPtr)1))
            {
                 //Handle hard button
            }
        }

来自 SIP 时,按键的 LParam 似乎始终为“1”。 我将继续在我们所有的设备类型上进行测试

如果有人有更好的方法,请在下面发帖:)

关于c# - 指示 KeyPress 是否来自 SIP,而不是硬按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13793923/

相关文章:

compact-framework - 无法加载 DLL 'coredll.dll' : The specified module could not be found.(在 Windows XP 上)

c# - 如何通过 Windows Mobile 6 使用存储管理器 API 格式化 SD 卡

c# - 将 C# 字符串传递给 Windows Mobile 中的非托管 C DLL

C#:if else 语句与 listView

C# - 将 DataGridView 保存到文件并加载

c# - 在 C# 中使用 DataContractJsonSerializer 使用 List<> 反序列化 JSON 对象

c# - SQL CE native 异常0xc0000005

c# - 在 C# 中绘图的代码效率?

c# - AWS 分段上传错误 : The XML you provided was not well-formed or did not validate against our published schema

c# - 我可以有这样的 if 语句吗?如果 Test = "test1"或 "test2"或 "test3"而不是走很远的路?