Well today I've tried implementing a NativeWindow listener class in an attempt to intercept the WM_MOUSEMOVE message and set wParam to 1 (indicating left mouse button down):-
Code:
internal class SplitterListener : NativeWindow
{
private const int WM_MOUSEMOVE = 0x0200;
private Splitter parent;
public SplitterListener(Splitter parent)
{
parent.HandleCreated += new EventHandler(this.OnHandleCreated);
parent.HandleDestroyed += new EventHandler(this.OnHandleDestroyed);
this.parent = parent;
}
// Listen for the control's window creation and then hook into it.
internal void OnHandleCreated(object sender, EventArgs e)
{
// Window is now created, assign handle to NativeWindow.
AssignHandle(((Splitter)sender).Handle);
}
internal void OnHandleDestroyed(object sender, EventArgs e)
{
// Window was destroyed, release hook.
ReleaseHandle();
}
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_MOUSEMOVE)
m.WParam = (System.IntPtr)((int)m.WParam | 1);
this.DefWndProc(ref m);
}
}
After instantiating the class in my Form's constructor the message is picked up OK when the mouse moves over the splitter, however if I then check the value of e.Button within the splitter1_MouseMove event it is still "None"?!? I have verified that my listener is fired first and through the call to DefWndProc passes the message onto the event handler, yet the change is not registered?!? AAARRRRGGHH!