Tests show that if certain child control windows have the focus and they get a mousewheel message - and they have no use for it then windows will pass it up the chain to the parent window.
These types of controls include Edit boxes, butons.
That is why your main window gets the mousewhell message when as you say the editbox have the focus.
Other controls such as listboxes and comboboxes when they have focus makes use of mousewheel messages - they use it to scroll through their lists - and do not pass the mousewheel message up the chain.
I see an easy out of your problem (I tested this)
If your MainWindow is getting WM_MOUSEMOVE messages when you move the mouse into that box - then trap the WM_MOUSEMOVE message and set the focus to you mainwindow.
1 2 3
|
case WM_MOUSEMOVE:
SetFocus( hwnd);//set focus to main window
break;
|
You should now get WM_MOUSEWHEEL messages at the mainwindow.
To be consistent - so that we only use WM_MOUSEWHEEL messages when the mouse is
over the background - during WM_MOUSEWHEEL message check which window has the
focus and only take action when no window has focus or the mainwindow has the focus.
(This will avoid taking action on WM_MOUSEWHEEL message forwarded from those controls
which may have focus but don't use it)
1 2 3 4 5 6 7 8 9
|
case WM_MOUSEWHEEL:
//check which window has focus
HWND hwndFocus;
hwndFocus = GetFocus();
//only action messages when mainwindow or no-window has focus.
if (hwndFocus == NULL || hwndFocus== hwnd)
FlashWindow(hwnd,TRUE); //test
break;
|
So the first thing for you to test is to see if you get the WM_MOUSE move message when the mouse is in that box area .