如何阻止FilterMessage继续进行?

时间:2012-02-23 18:17:36

标签: wpf textbox message handle intptr

我期待找到一种方法来阻止我的信息继续进行,换句话说就是让它得到处理。

假设,光标位置在文本框中,我正在扫描条形码“#Save#”。我认识到使用WindowProc这是条形码文本,我处理保存文本(通过保存我的表单),但现在我不想在文本框中写这个文本(“#Save#”)。

所以简而言之,我正在寻找一个属性或方法来说明这个文本(输入)被处理的窗口,不要做任何进一步的动作。

HwndSource source = (HwndSource)PresentationSource.FromDependencyObject(this);
source.AddHook(WindowProc);

private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)

{  

    if(device == barcode)  
    {  
        ......
        .....
        //Did some action

        //tried to stop msg to follow further in loop, but not working
        handled ==true;
    }

return IntPtr.Zero;

}

1 个答案:

答案 0 :(得分:0)

这是一个错字,额外的等号吗?您的代码为:

handled ==true;

这不是一项任务,但我认为这甚至不应该编译......

did you mean:

handled = true;
相关问题