次のプログラムを実行した後、マウスの速度が変わらないのはなぜですか?
SPI_SETMOUSESPEEDが原因ですか、それともSPIF_UPDATEINIFILE、SPIF_SENDCHANGEおよびSPIF_SENDCHANGEパラメータでwininiファイルを変更できないためですか?
コンパイラ: 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<<"\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;
}