-
May 30th, 2012, 04:39 AM
#1
[RESOLVED] Mouse whhel cycling
I want to run soem code by rolling a mouse wheel.
MFC, doc/view
In Mainframe header:
Code:
afx_msg BOOL OnMouseWheel (UINT nFlags, short zDelta, CPoint pt);
In source message map:
Event handler:
Code:
BOOL CMainFrame::OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
{
if (zDelta>0)
{
OnDemokey();
}
else
{
OnMinuskey();
};
return TRUE;
};
If i roll forward my code cyling in "OnDemokey();" if i roll back - in "OnMinuskey();"
What have I do to make act of rolling the wheel to work like an ordinary key pressing?
-
May 30th, 2012, 05:13 AM
#2
Re: Mouse whhel cycling
Originally Posted by 330xi
...
What have I do to make act of rolling the wheel to work like an ordinary key pressing?
Do you mean "MK_MBUTTON - the middle mouse button is down" or what?
Victor Nijegorodov
-
May 31st, 2012, 01:49 AM
#3
Re: Mouse whhel cycling
Originally Posted by VictorN
Do you mean "MK_MBUTTON - the middle mouse button is down" or what?
Very often, the element between left and right mouse button is a kind of wheel. You can push or you can roll it forward or backward. The second kind of movement people perform when they want to move text in browser up or down, for instance. Or with ctrl pressed they change the scale of a picture in Paint win7 or the scale of a text in MS Word or so.
So I want to work not with pressing this wheellike piece of plastic, but with its onestep rolling.
-
May 31st, 2012, 03:21 AM
#4
Re: Mouse whhel cycling
What have I do to make act of rolling the wheel to work like an ordinary key pressing?
To do what? If you have an ordinary keypress handlers, just call them appropriately from the wheel handler.
Best regards,
Igor
-
May 31st, 2012, 04:03 AM
#5
Re: Mouse whhel cycling
Originally Posted by Igor Vartanov
To do what? If you have an ordinary keypress handlers, just call them appropriately from the wheel handler.
I do exactly like that: I try to call my keypress handlers (OnDemokey(); OnMinuskey() ) in wheel handler (OnMouseWheel), problem is that this call unexpectedly repeats many-many times until program fails with "Unhadled exception ... Stack overflow" Break или Continue? If second, then: "Unhadled exception ... Access violation writing".
-
May 31st, 2012, 04:18 AM
#6
Re: Mouse whhel cycling
Perhaps, you should call these OnDemokey(); OnMinuskey() not every time but depending on the zDelta value?
Or, maybe, you should return FALSE just after calling these OnDemokey(), OnMinuskey() ?
Victor Nijegorodov
-
May 31st, 2012, 05:36 AM
#7
Re: Mouse whhel cycling
Don't you think that providing a compilable minimal project reproducing your problem would solve your issue much faster than telling us what you do and what you get?
Best regards,
Igor
-
June 13th, 2012, 04:09 AM
#8
Re: Mouse whhel cycling
Originally Posted by Igor Vartanov
Don't you think that providing a compilable minimal project reproducing your problem would solve your issue much faster than telling us what you do and what you get?
I do. May be later I will come back to this problem. The counting was that somebody already had such symptoms in his experience and the disease had been eliminated.
-
August 2nd, 2012, 06:09 AM
#9
Re: Mouse whhel cycling
I got the wanted result:
I start to send messages as if this keys have been pressed out of mousewheel handler instead of calling their handlers..
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
|