我期待找到一种方法来阻止我的消息继续进行,或者换句话说,让它得到处理。
说,光标位置在文本框,我正在扫描条形码“#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;
}