/* program to (re)set cursors after changing the cursor files, optionally to change the cursor base size Windows uses 32, 48, 64 etc. You can use any value you like, but I suggest sticking to those values, as otherwise Windows will have to rescale the cursors */ using System; using System.Globalization; using System.Runtime.InteropServices; using System.Reflection; // edit this if you change the program, so you know the compiled version is different [assembly: AssemblyTitle("reset cursors, optionally change base size")] [assembly: AssemblyCompany("skeptic Mike")] [assembly: AssemblyProduct("resetCursors")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")] namespace setCursors { class Program { [DllImport("user32.dll", SetLastError = true)] static extern bool SystemParametersInfo(int uiAction, int uiParam, int pvParam, int fWinIni); static void Main(string[] args) { const int SPI_SETCURSORS = 0x0057; const int SPIF_UPDATEINIFILE = 0x01; const int SPIF_SENDCHANGE = 0x02; // see https://stackoverflow.com/questions/60104778/change-and-update-the-size-of-the-cursor-in-windows-10-via-powershell/69687213#69687213 // for cursor size changing int baseSize = 0; int arg0 = 0; if (args.Length == 1) { if (int.TryParse(args[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out arg0) && arg0 >= 32 && arg0 <= 256) { baseSize = arg0; SystemParametersInfo(0x2029, 0, baseSize, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); } } SystemParametersInfo(SPI_SETCURSORS, 0, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); } } }