Jump to content

SystemParametersInfo dll call


dexto
 Share

Recommended Posts

I am lost on how to let dll set the value i am calling for:

Here is set function i written for setting mouse speed:

Local $pvParam = 15; mouse speed
Const $SPI_SETMOUSESPEED = 113
Const $SPI_GETMOUSESPEED = 112
Const $SPIF_UPDATEINIFILE = 1
Const $SPIF_SENDCHANGE = 2
$ret = DllCall("User32", "int", "SystemParametersInfo", _
        "int", $SPI_SETMOUSESPEED, _
        "int", 0, _
        "int", $pvParam, _
        "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE) _
        )
MsgBox(0, "", $ret[0])

Now... how do you use $SPI_GETMOUSESPEED?

SPI_GETMOUSESPEED

Retrieves the current mouse speed. The mouse speed determines how far the pointer will move based on the distance the mouse moves. The pvParam parameter must point to an integer that receives a value which ranges between 1 (slowest) and 20 (fastest). A value of 10 is the default. The value can be set by an end-user using the mouse control panel application or by an application using SPI_SETMOUSESPEED.

http://msdn.microsoft.com/en-us/library/ms724947(VS.85).aspx Edited by dexto
Link to comment
Share on other sites

#include <Array.au3>

Global Const $SPI_GETMOUSESPEED = 0x0070
Global Const $SPI_SETMOUSESPEED = 0x0071
Global $aReturn
Global $iMouseSpeed

$aReturn = DllCall('user32.dll', 'int', 'SystemParametersInfo', 'uint', $SPI_GETMOUSESPEED, 'uint', 0, _
            'int*', '', 'uint', 0)          
_ArrayDisplay($aReturn)
$iMouseSpeed = $aReturn[3]

$aReturn = DllCall('user32.dll', 'int', 'SystemParametersInfo', 'uint', $SPI_SETMOUSESPEED, 'uint', 0, _
            'int', 1, 'uint', 0)
            
$aReturn = DllCall('user32.dll', 'int', 'SystemParametersInfo', 'uint', $SPI_GETMOUSESPEED, 'uint', 0, _
            'int*', '', 'uint', 0)          
_ArrayDisplay($aReturn)

$aReturn = DllCall('user32.dll', 'int', 'SystemParametersInfo', 'uint', $SPI_SETMOUSESPEED, 'uint', 0, _
            'int', $iMouseSpeed, 'uint', 0)
            
$aReturn = DllCall('user32.dll', 'int', 'SystemParametersInfo', 'uint', $SPI_GETMOUSESPEED, 'uint', 0, _
            'int*', '', 'uint', 0)          
_ArrayDisplay($aReturn)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...