Created
February 24, 2014 06:02
-
-
Save wyvernzora/9182683 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Windows; | |
namespace Launcher | |
{ | |
public static class Utilities | |
{ | |
#region Win32 Calls | |
[DllImport("user32.dll")] | |
[return: MarshalAs(UnmanagedType.Bool)] | |
private static extern bool GetCursorPos(ref Win32Point pt); | |
[StructLayout(LayoutKind.Sequential)] | |
private struct Win32Point | |
{ | |
public Int32 X; | |
public Int32 Y; | |
} | |
#endregion | |
/// <summary> | |
/// Gets the on screen position of the cursor. | |
/// </summary> | |
/// <returns></returns> | |
public static Point GetCursorPosition() | |
{ | |
Win32Point point = new Win32Point(); | |
GetCursorPos(ref point); | |
return new Point(point.X, point.Y); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment