1

我正在尝试获取所有告诉用户已触摸屏幕的 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 消息。我想知道这怎么可能,我怎样才能得到这个消息。

4

1 回答 1

1

对于这种情况,可以使用Win32 API 函数SetCapture 。您可以将主窗体的句柄传递给它,它会捕获所有鼠标事件,直到您调用ReleaseCapture

于 2011-08-19T16:04:46.960 回答