using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace Apewer.Internals.Interop
{
[System.Security.SecuritySafeCritical]
class User32
{
public const int SC_CLOSE = 0xF060;
/// 窗体动画。
/// 窗体句柄。
/// 动画时间(毫秒)。
/// 动画组合名称。
[DllImport("user32")]
public static extern bool AnimateWindow(IntPtr hwnd, int dwtime, int dwflag);
/// Passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call this function either before or after processing the hook information.
/// This parameter is ignored.
/// The hook code passed to the current hook procedure. The next hook procedure uses this code to determine how to process the hook information.
/// The wParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
/// The lParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.
/// This value is returned by the next hook procedure in the chain. The current hook procedure must also return this value. The meaning of the return value depends on the hook type. For more information, see the descriptions of the individual hook procedures.
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);
///
///
///
///
[DllImport("user32.dll")]
public static extern int ChangeDisplaySettings(ref DevMode devMode, int flags);
/// Destroys an icon and frees any memory the icon occupied.
/// details: https://msdn.microsoft.com/en-us/library/windows/desktop/ms648063(v=vs.85).aspx
/// A handle to the icon to be destroyed. The icon must not be in use.
[DllImport("user32.dll")]
public static extern bool DestroyIcon(IntPtr hIcon);
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
public static extern bool ExitWindowsEx(int flg, int rea);
///
///
///
///
///
[DllImport("user32.dll")]
public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DevMode devMode);
///
///
///
///
[DllImport("user32")]
public static extern int EnumWindows(EnumWindowsCallBack x, int y);
///
[DllImport("User32.dll ", EntryPoint = "FindWindow")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
///
[DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string strClass, string strWindow);
///
///
///
///
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int GetClassLong(IntPtr hwnd, int nIndex);
///
///
///
///
///
[DllImport("user32.dll")]
public static extern int GetClassNameW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpString, int nMaxCount);
///
///
///
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
public static extern IntPtr GetDC(IntPtr hwnd);
///
///
///
[DllImport("user32")]
public static extern int GetKeyboardState(byte[] pbKeyState);
///
///
///
[DllImport("User32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern short GetKeyState(int KeyCode);
[DllImport("User32.dll")]
public static extern bool GetLastInputInfo(ref LASTINPUTINFO Dummy);
[DllImport("user32.dll", EntryPoint = "GetSystemMenu")]
public static extern IntPtr GetSystemMenu(IntPtr hWnd, IntPtr bRevert);
///
///
///
///
[DllImport("user32", EntryPoint = "GetWindowLong")]
public static extern int GetWindowLong(IntPtr hwnd, int nindex);
///
[DllImport("user32.dll")]
public static extern bool GetWindowRect(HandleRef hwnd, out NativeRECT rect);
///
///
///
///
///
[DllImport("user32.dll")]
public static extern int GetWindowTextW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpString, int nMaxCount);
///
///
///
[DllImport("user32.dll")]
public static extern bool IsWindowVisible(int hWnd);
///
///
///
///
///
[DllImport("user32.dll")]
public static extern void keybd_Callback(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);
/// 发送键盘事件。
/// 按键的虚拟键值
/// 扫描码,一般不用设置,用 0 代替。
/// 选项标志:0 按下,2 释放。
/// 扩展信息,默认为 0。
[DllImport("user32.dll")]
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
[DllImport("User32.dll")]
public static extern bool LockWorkStation();
///
///
///
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool MessageBeep(int type);
///
///
///
///
///
///
[DllImport("user32.dll")]
public static extern void mouse_Callback(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
///
///
///
///
///
///
[DllImport("user32.dll")]
public static extern void mouse_Callback(MouseCallbackFlag flags, int dx, int dy, uint data, UIntPtr extraInfo);
/// 发送消息,不等待返回。
///
///
///
///
///
[DllImport("user32.dll ", CharSet = CharSet.Unicode)]
public static extern IntPtr PostMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
///
/// Creates an array of handles to icons that are extracted from a specified file.
/// This function extracts from executable (.exe), DLL (.dll), icon (.ico), cursor (.cur), animated cursor (.ani), and bitmap (.bmp) files.
/// Extractions from Windows 3.x 16-bit executables (.exe or .dll) are also supported.
///
/// details: https://msdn.microsoft.com/en-us/library/windows/desktop/ms648075(v=vs.85).aspx
/// file name
/// The zero-based index of the first icon to extract.
/// The horizontal icon size wanted.
/// The vertical icon size wanted.
/// (out) A pointer to the returned array of icon handles.
/// (out) A pointer to a returned resource identifier.
/// The number of icons to extract from the file. Only valid when *.exe and *.dll
/// Specifies flags that control this function.
[DllImport("user32.dll")]
public static extern int PrivateExtractIcons(string lpszFile, int nIconIndex, int cxIcon, int cyIcon, IntPtr[] phicon, int[] piconid, int nIcons, int flags);
/// 发送消息,不等待返回。
///
///
///
///
///
[DllImport("user32.dll ", CharSet = CharSet.Unicode)]
public static extern IntPtr PostMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
///
///
[DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
public static extern int ReleaseCapture();
///
///
///
///
[DllImport("user32.dll", ExactSpelling = true)]
public static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
[DllImport("user32.dll", EntryPoint = "RemoveMenu")]
public static extern int RemoveMenu(IntPtr hMenu, int nPos, int flags);
/// 发送消息,并等待返回。
///
///
///
///
///
[DllImport("user32.dll", EntryPoint = "SendMessage")]
public static extern int SendMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
/// 发送消息,并等待返回。
///
///
///
///
///
[DllImport("user32.dll")]
[System.Security.SecuritySafeCritical]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
///
///
///
[DllImport("user32.dll")]
public static extern IntPtr SetActiveWindow(IntPtr hWnd);
///
///
///
///
///
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SetClassLong(IntPtr hwnd, int nIndex, int dwNewLong);
///
///
///
///
[DllImport("user32.dll")]
public static extern bool SetCursorPos(int X, int Y);
///
///
///
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool SetProcessDPIAware();
///
/// https://docs.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-setwindowshookexa
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);
///
///
///
///
///
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hwnd, int nindex, int dwnewlong);
///
///
///
///
///
///
///
///
///
[DllImport("user32.dll")]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndlnsertAfter, int X, int Y, int cx, int cy, uint Flags);
///
///
///
///
///
[DllImport("user32.dll")]
public static extern int SetWindowRgn(IntPtr hwnd, int hRgn, Boolean bRedraw);
///
///
///
///
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
///
///
///
///
///
///
///
[DllImport("user32")]
public static extern int ToAscii(int uVirtKey, int uScanCode, byte[] lpbKeyState, byte[] lpwTransKey, int fuState);
///
///
///
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern bool UnhookWindowsHookEx(int idHook);
///
///
///
///
///
///
///
///
///
///
///
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
public static extern int UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcdst, ref Point pptdst, ref Size psize, IntPtr hdcsrc, ref Point pptsrc, Int32 crkey, ref BlendFunction pblend, Int32 dwflags);
}
}