mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-07 23:46:00 +12:00
commit
ad67b4837e
|
@ -1267,5 +1267,22 @@ public static string NumberToLetters(int num)
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool TryFixHandCursor()
|
||||||
|
{
|
||||||
|
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)));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// If it fails, we'll just have to live with the old hand.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -82,6 +82,7 @@ public static class NativeConstants
|
||||||
|
|
||||||
public const uint ECM_FIRST = 0x1500;
|
public const uint ECM_FIRST = 0x1500;
|
||||||
public const uint EM_SETCUEBANNER = ECM_FIRST + 1;
|
public const uint EM_SETCUEBANNER = ECM_FIRST + 1;
|
||||||
|
public const int IDC_HAND = 32649;
|
||||||
public const uint MA_ACTIVATE = 1;
|
public const uint MA_ACTIVATE = 1;
|
||||||
public const uint MA_ACTIVATEANDEAT = 2;
|
public const uint MA_ACTIVATEANDEAT = 2;
|
||||||
public const uint MA_NOACTIVATE = 3;
|
public const uint MA_NOACTIVATE = 3;
|
||||||
|
|
|
@ -193,6 +193,9 @@ public static partial class NativeMethods
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
public static extern bool IsZoomed(IntPtr hWnd);
|
public static extern bool IsZoomed(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern IntPtr LoadCursor(IntPtr hInstance, int iconId);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
public static extern bool PrintWindow(IntPtr hwnd, IntPtr hDC, uint nFlags);
|
public static extern bool PrintWindow(IntPtr hwnd, IntPtr hDC, uint nFlags);
|
||||||
|
|
|
@ -226,8 +226,10 @@ public static string ScreenshotsFolder
|
||||||
[STAThread]
|
[STAThread]
|
||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
#if !DEBUG // Allow Visual Studio to break on exceptions in Debug builds.
|
||||||
Application.ThreadException += Application_ThreadException;
|
Application.ThreadException += Application_ThreadException;
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
#endif
|
||||||
|
|
||||||
StartTimer = Stopwatch.StartNew(); // For be able to show startup time
|
StartTimer = Stopwatch.StartNew(); // For be able to show startup time
|
||||||
|
|
||||||
|
@ -288,6 +290,7 @@ private static void Run()
|
||||||
|
|
||||||
LanguageHelper.ChangeLanguage(Settings.Language);
|
LanguageHelper.ChangeLanguage(Settings.Language);
|
||||||
|
|
||||||
|
Helpers.TryFixHandCursor();
|
||||||
DebugHelper.WriteLine("MainForm init started.");
|
DebugHelper.WriteLine("MainForm init started.");
|
||||||
MainForm = new MainForm();
|
MainForm = new MainForm();
|
||||||
DebugHelper.WriteLine("MainForm init finished.");
|
DebugHelper.WriteLine("MainForm init finished.");
|
||||||
|
@ -500,6 +503,7 @@ private static bool CheckAdminTasks()
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Helpers.TryFixHandCursor();
|
||||||
Application.Run(new DNSChangerForm());
|
Application.Run(new DNSChangerForm());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue