Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 Location: Tampa, FL Thanks: 28 times Was thanked: 416 time(s) in 354 post(s)
|
Here are a pair of scripts to send Control + Mouse Wheel Scroll Up and Down, usually to zoom in and zoom out. API documentation for the WM_MOUSEWHEEL message: https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-mousewheelZoom In:Code://Send Control down, as some apps don't fully accept the mouse message's control key part of the message
sp.SendControlDown();
sp.Sleep(10);
//Set the high-order word (mouse scroll delta) to 120 [scroll up],
//set low-order word to 0x0008 [MK_CONTROL] (Control key is down)
var wParam = (120 << 16) | 0x0008;
//Set high-order word to the mouse Y coordinate,
//set the low-order word to the mouse X coordinate
var lParam = (action.Start.Y << 16) | action.Start.X;
//Post the WM_MOUSEWHEEL message [0x020A] to the control below the mouse
action.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(wParam), new IntPtr(lParam));
sp.SendControlUp();
Zoom Out:Code://Send Control down, as some apps don't fully accept the mouse message's control key part of the message
sp.SendControlDown();
sp.Sleep(10);
//Set the high-order word (mouse scroll delta) to -120 [scroll down],
//set low-order word to 0x0008 [MK_CONTROL] (Control key is down)
var wParam = (-120 << 16) | 0x0008;
//Set high-order word to the mouse Y coordinate,
//set the low-order word to the mouse X coordinate
var lParam = (action.Start.Y << 16) | action.Start.X;
//Post the WM_MOUSEWHEEL message [0x020A] to the control below the mouse
action.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(wParam), new IntPtr(lParam));
sp.SendControlUp();
Edited by user Sunday, April 28, 2019 7:52:23 PM(UTC)
| Reason: Updated to add sending the control key down as well
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Newbie
Groups: Approved
Joined: 4/15/2021(UTC) Posts: 1 Location: Singapore Thanks: 1 times
|
Hi Rob, Many thanks for the post. It solved my question existing for a long time. I was the old version suer of Strokesplus. With your scripts, I am now able to use the .net version because of your contribution on Ctrl+wheel up/down.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close