Using a floating-point number on a DLLCall() argument?

Get help with using AutoHotkey and its commands and hotkeys
pzycx
Posts: 3
Joined: 08 Aug 2020, 06:10

Using a floating-point number on a DLLCall() argument?

08 Aug 2020, 06:18

I have this small piece of code that changes my Windows pointer speed,

Code: Select all

DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UInt, 10, UInt, 0) ; 10 is the speed parameter (3rd argument), if I put it as 20 it will make my pointer speed 20
What I'm wondering, is there any way to use a floating-point number on the third argument? What I tried doing is changing the argument's type, UInt, to UFloat or Float but it didn't work. Is there something I'm missing?
My attempt on this:

Code: Select all

DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UFloat, 7.5, UInt, 0)
I'm doing this so I can get a more precise pointer speed multiplier. Thank you in advance! :D
BoBo
Posts: 3755
Joined: 13 May 2014, 17:15

Re: Using a floating-point number on a DLLCall() argument?

08 Aug 2020, 06:41

This might shed some light on this, and if a parameters fixed type can be changed to a users liking: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa
All sizes and dimensions used by this function are measured in pixels.
http://www.jasinskionline.com/windowsapi/ref/s/systemparametersinfo.html
... means, you wanna set one of its fixed-parameters to use a fraction of a pixel?? :think:

... while 0x71 (labeld 0x0071 at the first link above) that is triggering SPI_SETMOUSESPEED
Sets the current mouse speed. The pvParam parameter is an integer between 1 (slowest) and 20 (fastest). A value of 10 is the default. This value is typically set using the mouse control panel application.
User avatar
boiler
Posts: 6107
Joined: 21 Dec 2014, 02:44

Re: Using a floating-point number on a DLLCall() argument?

08 Aug 2020, 07:12

You can’t use a different parameter type than the function is expecting to receive, and for SPI_SETMOUSESPEED, it expects that parameter to be an integer between 1 and 20.

By the way, there is no UFloat. An unsigned floating point variable wouldn’t make sense.
pzycx
Posts: 3
Joined: 08 Aug 2020, 06:10

Re: Using a floating-point number on a DLLCall() argument?

08 Aug 2020, 10:18

Thank you both for the replies, I understand now and I'll look for other workarounds. Have a great day!

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], f1ster, Google [Bot], mikeyww, Rikk03 and 47 guests