-
September 15th, 2010, 10:04 AM
#1
Horizontal scroll with OnMouseWheel ?
Hello,
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)
thx.
Ralf
-
September 16th, 2010, 04:05 AM
#2
Re: Horizontal scroll with OnMouseWheel ?
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).
-
September 16th, 2010, 04:33 AM
#3
Re: Horizontal scroll with OnMouseWheel ?
Hello,
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
-
September 16th, 2010, 06:49 AM
#4
Re: Horizontal scroll with OnMouseWheel ?
Handle WM_MOUSEHWHEEL message as well.
Note that requires at least Windows Vista and Windows Server 2008 (_WIN32_WINNT >= 0x0600).
-
September 16th, 2010, 07:29 AM
#5
Re: Horizontal scroll with OnMouseWheel ?
Originally Posted by ovidiucucu
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.
-
September 16th, 2010, 08:08 AM
#6
Re: Horizontal scroll with OnMouseWheel ?
Hello,
my customer uses Windows 7.
My app has an implementation for horizontal scrolling with shift+mouse wheel.
Then I implemented the horizontal wheel with this:
Code:
BOOL CTrackView::OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt)
{
return OnMouseWheel(nFlags | MK_SHIFT,zDelta,pt);
}
But the app crashes.
Has someone an idea why?
Ralf
-
September 16th, 2010, 07:25 AM
#7
Re: Horizontal scroll with OnMouseWheel ?
Originally Posted by Ralf Schneider
Hello,
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).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|