U
usunto_bryjamus
Hi,
I need to filter some messages in my form (in some situation I need to
avoid mouse messages) so I create derivedd class:
public class MyMessageWnd : MessageWindow
{
// When true mouse messages are avoided.
private bool enableFiltering;
public bool EnableFiltering
{
set
{
this.enableFiltering = value;
}
}
public MyMessageWnd(IntPtr wndHandle)
{
this.wndHandle = wndHandle;
this.enableFiltering = false;
}
// Only for this window avoid messages.
private IntPtr wndHandle;
const int WM_MOUSEACTIVATE = 0x21;
const int WM_MOUSEFIRST = 0x200;
const int WM_MOUSEHOVER = 0x2A1;
const int WM_MOUSELAST = 0x20A;
const int WM_MOUSELEAVE = 0x2A3;
const int WM_MOUSEMOVE = 0x200;
const int WM_MOUSEWHEEL = 0x20A;
protected override void WndProc(ref Message m)
{
if (!(this.enableFiltering && this.wndHandle != IntPtr.Zero
&& m.HWnd == this.wndHandle && (m.Msg == WM_MOUSEACTIVATE || m.Msg ==
WM_MOUSEFIRST || m.Msg == WM_MOUSEHOVER || m.Msg == WM_MOUSELAST ||
m.Msg == WM_MOUSELEAVE || m.Msg == WM_MOUSEMOVE || m.Msg == WM_MOUSEWHEEL)))
{
base.WndProc(ref m);
}
}
}
In my form class I declare like this:
....
MyMessageWnd mmw;
/// <summary>
/// Construktor.
/// </summary>
public FormCtor()
{
mmw = new MyMessageWnd(this.Handle);
mmw.EnableFiltering = false;
InitializeComponent();
...
}
....
Problem is that WndProc is called only when I close application. When I
click on form or press key nothing is happend. What is it? Meybe there
is some easier way to avoid mouse messages? I look in google but I found
only MessageWindow for this purpose.
I use netcf 2.0 with SP on WinCE 5.0 Symbol MC3090 device.
I need to filter some messages in my form (in some situation I need to
avoid mouse messages) so I create derivedd class:
public class MyMessageWnd : MessageWindow
{
// When true mouse messages are avoided.
private bool enableFiltering;
public bool EnableFiltering
{
set
{
this.enableFiltering = value;
}
}
public MyMessageWnd(IntPtr wndHandle)
{
this.wndHandle = wndHandle;
this.enableFiltering = false;
}
// Only for this window avoid messages.
private IntPtr wndHandle;
const int WM_MOUSEACTIVATE = 0x21;
const int WM_MOUSEFIRST = 0x200;
const int WM_MOUSEHOVER = 0x2A1;
const int WM_MOUSELAST = 0x20A;
const int WM_MOUSELEAVE = 0x2A3;
const int WM_MOUSEMOVE = 0x200;
const int WM_MOUSEWHEEL = 0x20A;
protected override void WndProc(ref Message m)
{
if (!(this.enableFiltering && this.wndHandle != IntPtr.Zero
&& m.HWnd == this.wndHandle && (m.Msg == WM_MOUSEACTIVATE || m.Msg ==
WM_MOUSEFIRST || m.Msg == WM_MOUSEHOVER || m.Msg == WM_MOUSELAST ||
m.Msg == WM_MOUSELEAVE || m.Msg == WM_MOUSEMOVE || m.Msg == WM_MOUSEWHEEL)))
{
base.WndProc(ref m);
}
}
}
In my form class I declare like this:
....
MyMessageWnd mmw;
/// <summary>
/// Construktor.
/// </summary>
public FormCtor()
{
mmw = new MyMessageWnd(this.Handle);
mmw.EnableFiltering = false;
InitializeComponent();
...
}
....
Problem is that WndProc is called only when I close application. When I
click on form or press key nothing is happend. What is it? Meybe there
is some easier way to avoid mouse messages? I look in google but I found
only MessageWindow for this purpose.
I use netcf 2.0 with SP on WinCE 5.0 Symbol MC3090 device.