You can return without calling base.WndProc
:
protected override void WndProc(ref Message m){
if(m.Msg == WM_SETCURSOR) {
int lowWord = (m.LParam.ToInt32() << 16) >> 16;
if(lowWord == HTCLIENT){
SetCursor(hCursor);
return;
}
}
base.WndProc(ref m);
}
I guess this also works (I've experienced it with some messages but not sure with WM_SETCURSOR
):
protected override void WndProc(ref Message m){
base.WndProc(ref m);
if(m.Msg == WM_SETCURSOR) {
int lowWord = (m.LParam.ToInt32() << 16) >> 16;
if(lowWord == HTCLIENT){
SetCursor(hCursor);
m.Result = new IntPtr(1);
}
}
}