StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Rob  
#1 Posted : Sunday, April 28, 2019 6:30:19 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
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-mousewheel

Zoom 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

thanks 1 user thanked Rob for this useful post.
jeff on 4/15/2021(UTC)
jeff  
#2 Posted : Thursday, April 15, 2021 4:08:01 AM(UTC)
jeff

Rank: Newbie

Reputation:

Groups: Approved
Joined: 4/15/2021(UTC)
Posts: 1
Singapore
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.
Users browsing this topic
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.