View Single Post
Old 04-28-2010, 01:28 PM   #28
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

Now knowing that the mouse wheel does work after a right-click, I thought I'd [grab a beer and] have another look at IGraphicsWin::WndProc().

Apparently mouse wheel messages only make it to plug-in's window after the window has explicitly received focus. Simply clicking in the plug-in's window doesn't sent a WM_SETFOCUS message to the window, so any mouse wheel messages are lost. After a right-click a WM_SETFOCUS message is sent to the plug-in's window, so that's why mouse wheel messages do work from then on (or at least until the window loses focus again).

Here's a solution that I think more or less works (but which will require more testing, and probably more thinking):

Code:
case WM_MOUSEACTIVATE: {
	SetFocus(hWnd);
	return MA_ACTIVATE;
}
You add this case to the switch(msg) statement in IGraphicsWin::WndProc().

This sets the focus to the plug-in's window when it receives its first mouse click. So you do need to click inside the plug-in's window at least once first, but after that the mouse wheel works fine.
Tale is offline   Reply With Quote