using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; namespace Apewer.Internals.Interop { [System.Security.SecuritySafeCritical] class User32 { /// 窗体动画。 /// 窗体句柄。 /// 动画时间(毫秒)。 /// 动画组合名称。 [DllImport("user32")] public static extern bool AnimateWindow(IntPtr hwnd, int dwtime, int dwflag); /// /// /// /// /// /// [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern int CallNextHookEx(int idHook, int nCode, Int32 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", 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); /// /// /// [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 = "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", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern int SetWindowsHookEx(int idHook, SetWindowsHookExHookProc 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); } }