2025-03-28 09:49:56 +08:00

68 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace SacnUpload
{
public static class Win32Api
{
/// <summary>
/// 键入
/// </summary>
public const int WM_KEYDOWN = 0x100;
[DllImport("user32.dll", EntryPoint = "SendMessageW")]
public static extern int SendMessage(
int hwnd,
int wMsg,
int wParam,
int lParam);
[DllImport("user32.dll", EntryPoint = "PostMessageW")]
public static extern int PostMessage(
int hwnd,
int wMsg,
int wParam,
int lParam);
[DllImport("user32.dll")]
public static extern int GetForegroundWindow();
[DllImport("user32.dll")]
public static extern IntPtr GetLastActivePopup(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern int GetFocus();
[DllImport("user32.dll")]
public static extern int AttachThreadInput(
int idAttach,
int idAttachTo,
int fAttach);
[DllImport("user32.dll")]
public static extern int GetWindowThreadProcessId(
int hwnd,
int lpdwProcessId);
[DllImport("kernel32.dll")]
public static extern int GetCurrentThreadId();
[DllImport("user32.dll")]
public static extern IntPtr GetDesktopWindow();
[DllImport("User32.dll")]
public static extern int GetWindowLong(IntPtr hWnd, int nIdex);
[DllImport("User32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("User32.dll")]
public static extern void keybd_event(byte bVK, byte bScan, Int32 dwFlags, int dwExtraInfo);
[DllImport("User32.dll")]
public static extern uint MapVirtualKey(uint uCode, uint uMapType);
[DllImport("user32.dll", EntryPoint = "GetKeyboardState")]
public static extern int GetKeyboardState(byte[] pbKeyState);
}
}