HeavenStudio/Assets/Plugins/Starpelly/User32.cs
2021-12-18 23:10:43 -05:00

56 lines
1.9 KiB
C#

using System;
using System.Runtime.InteropServices;
using System.Text;
using Starpelly.Common;
using Starpelly.Enums.Windows;
namespace Starpelly.OS
{
public class User32
{
#region Input
[DllImport("user32.dll", EntryPoint = "SetCursor")]
public static extern IntPtr SetCursor(IntPtr hCursor);
[DllImport("user32.dll", EntryPoint = "LoadCursor")]
public static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);
[DllImport("user32.dll", SetLastError = true)]
public static extern uint SendInput(uint numberOfInputs, INPUT[] inputs, int sizeOfInputStructure);
[DllImport("user32.dll")]
public static extern long SetCursorPos(int x, int y);
[DllImport("user32.dll")]
public static extern bool ClientToScreen(IntPtr hWnd, ref POINT point);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetCursorPos(out POINT p);
[DllImport("user32.dll", SetLastError = true)]
public static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);
[DllImport("user32.dll")]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
public static extern IntPtr GetWindowDC(IntPtr ptr);
#endregion
#region Window
[DllImport("user32.dll", EntryPoint = "SetWindowText")]
public static extern bool SetWindowText(IntPtr hwnd, String lpString);
[DllImport("user32.dll", EntryPoint = "FindWindow")]
public static extern IntPtr FindWindow(String className, String windowName);
[DllImport("user32.dll")]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
#endregion
}
}