为什么执行以下程序后鼠标速度没有变化?
是由于SPI_SETMOUSESPEED还是由于无法通过SPIF_UPDATEINIFILE、SPIF_SENDCHANGE和SPIF_SENDCHANGE参数更改winini文件?
编译器:g++,操作系统: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<<"\n\nPrevious Mouse Speed was : " << *MouseSpeed ;
cout<<"\n\nSystemParametersInfo 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<<"\n\nCurrent Mouse Speed is : " << *MouseSpeed ;
cout<<"\n\nSystemParametersInfo return status for SPI_SETMOUSESPEED : " << x << "\n\n" ;
}
if( !x )
cout<< "Error Status : " << GetLastError() << "\n\n";
return 0;
}