2025-07-23 05:41:01 +00:00
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
using Windows.Win32;
|
|
|
|
|
|
|
2025-07-23 05:44:31 +00:00
|
|
|
|
namespace Flow.Launcher.Plugin.SharedModels;
|
2025-07-23 05:41:01 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Contains full information about a cursor.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// Use this class to replace the System.Windows.Forms.Cursor class which can cause possible System.PlatformNotSupportedException.
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
public class CursorInfo
|
|
|
|
|
|
{
|
2025-07-23 05:44:31 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the current position of the cursor in screen coordinates.
|
|
|
|
|
|
/// </summary>
|
2025-07-23 05:41:01 +00:00
|
|
|
|
public static Point Position
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!PInvoke.GetCursorPos(out var pt))
|
|
|
|
|
|
{
|
|
|
|
|
|
Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error());
|
|
|
|
|
|
}
|
|
|
|
|
|
return pt;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|