diff --git a/ShareX/Program.cs b/ShareX/Program.cs index 9daeb1ffa..6831feaf1 100644 --- a/ShareX/Program.cs +++ b/ShareX/Program.cs @@ -237,13 +237,6 @@ private static void Main(string[] args) CLI = new CLIManager(args); CLI.ParseCommands(); - // Fix the hand cursor before we open any form. - try - { - FixHandCursor(); - } - catch (Exception) { } // If it fails, we'll just have to live with the old hand. - #if STEAM if (CheckUninstall()) return; // Steam will run ShareX with -Uninstall when uninstalling #endif @@ -298,6 +291,7 @@ private static void Run() LanguageHelper.ChangeLanguage(Settings.Language); + TryFixHandCursor(); DebugHelper.WriteLine("MainForm init started."); MainForm = new MainForm(); DebugHelper.WriteLine("MainForm init finished."); @@ -510,6 +504,7 @@ private static bool CheckAdminTasks() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + TryFixHandCursor(); Application.Run(new DNSChangerForm()); return true; } @@ -591,11 +586,15 @@ private static void CleanTempFiles() }).Start(); } - private static void FixHandCursor() + private static void TryFixHandCursor() { - // https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Cursors.cs,423 - typeof(Cursors).GetField("hand", BindingFlags.NonPublic | BindingFlags.Static) - ?.SetValue(null, new Cursor(NativeMethods.LoadCursor(IntPtr.Zero, NativeConstants.IDC_HAND))); + try + { + // https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Cursors.cs,423 + typeof(Cursors).GetField("hand", BindingFlags.NonPublic | BindingFlags.Static) + ?.SetValue(null, new Cursor(NativeMethods.LoadCursor(IntPtr.Zero, NativeConstants.IDC_HAND))); + } + catch { } // If it fails, we'll just have to live with the old hand. } } } \ No newline at end of file