some special mouses have the ability to scroll also horizontal.
What message is sent in this case?
Can I use OnMouseWheel to handle this?
(I have noch such a mouse)
An horizontal scroll can already be realized with an ordinary mouse. You simply use the wheel and press the shift key at the same time.
You can test that behaviour with a modern internet browser, e.g. Chrome, and http://codeguru/forum/ . Resize the window in order to see the horizontal scrollbar. Then, press the shilft key and roll the wheel of your mouse. You can see an horizontal scroll.
I don't have a mouse with a special wheel for an horizontal scrolling, but I am pretty sure it works by simulating a pressure on the shift key and a motion of the wheel. In your program you would watch the WM_MOUSEWHEEL message (or onMouseWheel if you program with MFC) and watch the state of the shift key with GetKeyState(VK_SHIFT).
I know about the behaviour with the shift key.
It works in my app.
But a user with a special mouse for horizontal scrolling says, that it do not.
He can do it with shift and vert. scroll. But not with his horizontal scroll buttons.
thx.
Ralf
In XP he needs a special mouse driver for that device which should generate the needed messages, i. e. WM_MOUSEWHEEL, WM_KEYDOWN (of shift key) and setting the keyboard state (shift was pressed).
Handle WM_MOUSEHWHEEL message as well.
Note that requires at least Windows Vista and Windows Server 2008 (_WIN32_WINNT >= 0x0600).
You can try to setting _WIN32_WINNT=0x0600 in your preprocessor settings. If the mouse driver sends the WM_MOUSEWHEEL message you probably can handle the message even if not officially supported by the OS version.
To call a handler from a handler normally isn't so good an idea cause each handler function available might return 0 (== not handled) what causes the dispatcher to search for another handler in the chain of windows. When you call CTrackView::OnMouseWheel you actually break that kind of logic. So, you better send a WM_MOUSEWHEEL message and before set the 'Shift Key' to be pressed by calling SetKeyboardState. Probably you also have to send a WM_KEYDOWN message before. After that you can return with 1 (== handled) cause now the normal handling of the vertical mouse wheel handling should happen and if you were lucky it should recognize the SHIFT key is being pressed.
Did you change (or set) the _WIN32_WINNT macro to 0x0600 ? If yes, did you make a full rebuild after that? And didn't you use dlls where the _WIN32_WINNT macro was set differently?
The problem is that by setting the macro WINAPI header files and some structures would change in size. If you have mixed code or even use old precompiled headers the crash can be because of that.
That probably means that you need to set the _WIN32_WINNT macro to 0x0600 (or higher) cause Windows couldn't handle the message (you might find an entry in the eventvwr).
Simply set it in the preprocessor definitions of your project by
_WIN32_WINNT=0x0600
separated by comma , from rthe other macros. Then rebuild all.
That probably means that you need to set the _WIN32_WINNT macro to 0x0600 (or higher) cause Windows couldn't handle the message (you might find an entry in the eventvwr).
Simply set it in the preprocessor definitions of your project by
_WIN32_WINNT=0x0600
separated by comma , from rthe other macros. Then rebuild all.
the mouse driver sends the WM_MOUSEHWHEEL message.
The according function will also be called.
I thought, in this case I do not need to set the macro?
Bookmarks