[英]XElement.Load native exception in .NET CF Windows CE 5.0
[英].NET CF on Windows CE - problem with filtering system messages
我正在嘗試獲取所有Windows消息,告知用戶觸摸屏。 禁用該功能后,除按鈕外,它均可在任何地方使用。 似乎在禁用控件上單擊時,應用程序未收到任何消息。
我正在使用OpenNetCF Application2類來過濾消息:
Application2.AddMessageFilter(Device.PowerManager);
Application2.Run(new MainForm());
PowerManager類包含以下方法(根據IMessageFilter接口的要求):
public bool PreFilterMessage(ref Microsoft.WindowsCE.Forms.Message m)
{
log.DebugFormat("windows message {0} - 0x{0:X}", m.Msg);
if (m.Msg == 0x0201 || m.Msg == 0x8001 || m.Msg == 0x0005)
{
return this.ResetPowerManager();
}
return false;
}
單擊禁用按鈕時,在日志文件中沒有Windows消息的指示。 我想知道這怎么可能以及如何獲得此消息。
對於這種情況,可以使用Win32 API函數SetCapture 。 您可以將主窗體的句柄傳遞給它,它將捕獲所有鼠標事件,直到調用ReleaseCapture為止。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.