Scroll Bars and Focus
I have a seperate window (the map window from last thread) that I added scroll bars to. I would like that window to never have focus EXCEPT when the user uses the scroll bars. Before I added the scroll bars I just processed the WM_SETFOCUS command and used SetFocus to the window that I wanted the focus to be at. Well I quickly found out that using that code would block my scroll bars from working.
I'm not really sure where to begin. I'm thinking of processing the WM_SETFOCUS, finding out where the mouse is, if its not over a scroll bar using SetFocus to go back to main window, if it is over a scroll bar processing the change and when SB_ENDSCROLL occurs using SetFocus to go back.
Or am I just crazy?
Ok got it working. Here is the code I'm using if anyone is wondering.
Inside the WndProc for hMapWin:
HWND hMainWin, hMapWin;
When window recieves focus:
After user is done scrolling (processed in both WM_VSCROLL and WM_HSCROLL)
ScreenToClient (hMapWin, &pMouse);
if ( pMouse.x < 585 && pMouse.y < 585)
Only problem I see is when using the arrows at the end of the scroll bar the focus switches between windows quickly if the user clicks the arrow insteads of holding it down. Oh well small price to pay :)