#include "stdafx.h" #include <Windows.h> int _tmain(int argc, _TCHAR* argv[]) { BOOL bSwapped = ::GetSystemMetrics(SM_SWAPBUTTON); SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP,!bSwapped,NULL,SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //::SwapMouseButton( ! bSwapped); long err; // HKEY hkey; // err=RegOpenKeyEx(HKEY_CURRENT_USER ,_T("Control Panel\Mouse"),NULL,KEY_QUERY_VALUE|KEY_READ|KEY_ALL_ACCESS,&key); // if (err==ERROR_SUCCESS) // { // err=RegSetKeyValue(hkey,NULL,L"SwapMouseButtons",REG_SZ,"") // } return 0; }