I'm using a wheel mouse in my graphics application.
I can scroll the wheel mouse to zoom in and out and if I hold the wheel mouse down I can pan. This is the same funcionality as AutoCAD.
I now want to be able to double click the wheel mouse to do an zoom extents. How do I detect that the user has double clicked the wheel mouse?
Below is a sample of code I'm using:
case (WM_MOUSEWHEEL)
i2=HIWORD(wParam)
if (i2>0) then ! zoom in
! get new screen extents
else ! zoom out
! get new screen extents
end if
! display graphics
case (WM_MBUTTONDOWN) ! middle button down store postion
mButtonDown=.TRUE.
mButtonE=LOWORD(lParam) ! store cursor position in client view
mButtonN=HIWORD(lParam)
case (WM_MBUTTONUP) ! middle button up
mButtonDown=.FALSE.
Thanks
I can scroll the wheel mouse to zoom in and out and if I hold the wheel mouse down I can pan. This is the same funcionality as AutoCAD.
I now want to be able to double click the wheel mouse to do an zoom extents. How do I detect that the user has double clicked the wheel mouse?
Below is a sample of code I'm using:
case (WM_MOUSEWHEEL)
i2=HIWORD(wParam)
if (i2>0) then ! zoom in
! get new screen extents
else ! zoom out
! get new screen extents
end if
! display graphics
case (WM_MBUTTONDOWN) ! middle button down store postion
mButtonDown=.TRUE.
mButtonE=LOWORD(lParam) ! store cursor position in client view
mButtonN=HIWORD(lParam)
case (WM_MBUTTONUP) ! middle button up
mButtonDown=.FALSE.
Thanks
链接已复制
7 回复数
Thanks,
I've tried WM_MBUTTONDBLCLK and it's bot being recognised, I am recognising WM_MBUTTONDOWN - a sample of my code is shown below.
case (WM_MBUTTONDOWN) ! middle button down store postion
call MsgBox ('Middle mouse button down'c,"E")
MainWndProc = 0
end if
return
case (WM_MBUTTONDBLCLK)
call MsgBox ('Middle mouse button double click'c,"E")
MainWndProc = 0
return
It is a Windows application, not a QuickWin application but the double-click is not being recognised.
How can I tell which version I'm running - the 'help about' just gives the version of Visual Studio.
I've tried WM_MBUTTONDBLCLK and it's bot being recognised, I am recognising WM_MBUTTONDOWN - a sample of my code is shown below.
case (WM_MBUTTONDOWN) ! middle button down store postion
call MsgBox ('Middle mouse button down'c,"E")
MainWndProc = 0
end if
return
case (WM_MBUTTONDBLCLK)
call MsgBox ('Middle mouse button double click'c,"E")
MainWndProc = 0
return
It is a Windows application, not a QuickWin application but the double-click is not being recognised.
How can I tell which version I'm running - the 'help about' just gives the version of Visual Studio.
Thanks,
The build log says:
Compiling with Intel Visual Fortran Compiler XE 12.0.4.196 [IA-32]...
Do you have any suggestions why double clicking on the middle button on the mouse is not being recognised?
WM_MBUTTONDOWN and WM_MBUTTONUP are being recognised.
I've checked what message I'm getting - 519 & 520 for WM_MBUTTONDOWN & WM_MBUTTONUP which is Hex 207 & 208.
If I double click I just get a WM_MBUTTONDOWN followed by a WM_MBUTTONUP.
Maybe I will have to check on a 'Down' followed by an 'Up' over a 'short' time.
The build log says:
Compiling with Intel Visual Fortran Compiler XE 12.0.4.196 [IA-32]...
Do you have any suggestions why double clicking on the middle button on the mouse is not being recognised?
WM_MBUTTONDOWN and WM_MBUTTONUP are being recognised.
I've checked what message I'm getting - 519 & 520 for WM_MBUTTONDOWN & WM_MBUTTONUP which is Hex 207 & 208.
If I double click I just get a WM_MBUTTONDOWN followed by a WM_MBUTTONUP.
Maybe I will have to check on a 'Down' followed by an 'Up' over a 'short' time.
MSDN sez:
Only windows that have the CS_DBLCLKS style can receive WM_MBUTTONDBLCLK messages, which the system generates when the user presses, releases, and again presses the middle mouse button within the system's double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK, and WM_MBUTTONUP again.
Does your window have the CS_DBLCLKS style?
Only windows that have the CS_DBLCLKS style can receive WM_MBUTTONDBLCLK messages, which the system generates when the user presses, releases, and again presses the middle mouse button within the system's double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK, and WM_MBUTTONUP again.
Does your window have the CS_DBLCLKS style?
