2022-06-22 19:55:12 +00:00
|
|
|
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
2021-12-19 04:10:43 +00:00
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
using Starpelly.Common;
|
|
|
|
using Starpelly.Enums.Windows;
|
|
|
|
|
2022-06-22 19:55:12 +00:00
|
|
|
namespace Starpelly.OperatingSystem
|
2021-12-19 04:10:43 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
}
|
2022-06-22 19:55:12 +00:00
|
|
|
}
|
|
|
|
#endif
|