Why mouse speed is not changing after execution of the following program ?
Is it due to SPI_SETMOUSESPEED or due to unable to change the winini file by SPIF_UPDATEINIFILE , SPIF_SENDCHANGE and SPIF_SENDCHANGE parameters ?
Compiler : g++ , OS : Windows 8 .
#include <iostream>
#include <windows.h>
#include<winuser.h>
#pragma comment(lib, "user32.lib")
using namespace std ;
int main()
{
int i = 0 , *MouseSpeed = &i ;
bool x ;
// Retrieving the mouse speed .
x = SystemParametersInfo( SPI_GETMOUSESPEED , 0 , MouseSpeed , 0 ) ;
cout<<"
Previous Mouse Speed was : " << *MouseSpeed ;
cout<<"
SystemParametersInfo return status for SPI_GETMOUSESPEED : " << x ;
if( x )
{
i = 20 ;
MouseSpeed = &i ;
// Changing the mouse speed .
SystemParametersInfo( SPI_SETMOUSESPEED ,
0 ,
MouseSpeed ,
SPIF_UPDATEINIFILE ||
SPIF_SENDCHANGE ||
SPIF_SENDWININICHANGE ) ;
cout<<"
Current Mouse Speed is : " << *MouseSpeed ;
cout<<"
SystemParametersInfo return status for SPI_SETMOUSESPEED : " << x << "
" ;
}
if( !x )
cout<< "Error Status : " << GetLastError() << "
";
return 0;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…