LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use a wheel mouse in CVI

How can I get events from the wheel and/or third buttom of my wheel mouse? Do I need SDK functions? Any examples?

Thanks in advance

Willi
Message 1 of 5
(4,681 Views)
The mouse wheel will scroll any control or panel that has a scroll bar in CVI. Also, for the mouse wheel, you can set up what the wheel click does (double-click, etc.) and we would support that. Our callbacks do not support capturing these events to do custom code when the wheel is moved or clicked. If you want to do that, you would need to capture the Windows messages. The Windows messages are WM_MOUSEWHEEL and WM_MBUTTONDOWN. You can set up a callback for capturing these events by using the function InstallWinMsgCallback from the Programmer's Toolbox (cvi\toolslib\toolbox\toolbox.fp).

Best Regards,

Chris Matthews
National Instruments
Message 2 of 5
(4,680 Views)
Ok, it works.
But what about mouse wheel sense (up or down)?
wParam and lParam have always the same value...
0 Kudos
Message 3 of 5
(4,614 Views)
Sorry,
but you get here some information from Windows.
My question is:
can I get some information about the actual value of volume which is in windows used?
and
can I set the volume to another value?

thx
Florian
0 Kudos
Message 4 of 5
(4,595 Views)
Hello bicoun,

From looking at the MDSN information about the WM_MOUSEWHEEL event, you can detect if the mouse was moved up or down by seeing if the high order word of wParam is positive or negative. In particular, "a positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user". The article suggests using the following code: zDelta = GET_WHEEL_DELTA_WPARAM(wParam).

Hope that helps.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 5 of 5
(4,559 Views)