📄 innerwin32.cs
字号:
namespace Imps.Client.Pc
{
using System;
using System.Runtime.InteropServices;
public class InnerWin32
{
[DllImport("gdi32.dll")]
public static extern IntPtr CreateRoundRectRgn(int X1, int Y1, int X2, int Y2, int X3, int Y3);
[DllImport("user32")]
public static extern bool GetComboBoxInfo(IntPtr hwndCombo, ref ComboBoxInfo info);
[DllImport("user32.dll")]
public static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("user32")]
public static extern short GetKeyState(uint vk);
[DllImport("user32")]
public static extern int GetSystemMetrics(int nIndex);
[DllImport("user32.dll")]
public static extern bool GetUpdateRect(IntPtr hWnd, ref RECT lpRect, bool bErase);
[DllImport("user32.dll")]
public static extern IntPtr GetWindowDC(IntPtr hwnd);
[DllImport("user32.dll")]
public static extern int PostMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
[DllImport("gdi32.dll")]
public static extern int RoundRect(IntPtr hdc, int X1, int Y1, int X2, int Y2, int X3, int Y3);
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern int SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw);
[DllImport("user32")]
public static extern bool SystemParametersInfo(int uiAction, int uiParam, ref NonClientMetrics pvParam, int fWinIni);
[DllImport("comctl32.dll", EntryPoint="_TrackMouseEvent")]
public static extern bool TrackMouseEvent(TRACKMOUSEEVENT tme);
[StructLayout(LayoutKind.Sequential)]
public struct ComboBoxInfo
{
public int cbSize;
public InnerWin32.RECT rcItem;
public InnerWin32.RECT rcButton;
public IntPtr stateButton;
public IntPtr hwndCombo;
public IntPtr hwndEdit;
public IntPtr hwndList;
}
public enum HitTest
{
HTBORDER = 0x12,
HTBOTTOM = 15,
HTBOTTOMLEFT = 0x10,
HTBOTTOMRIGHT = 0x11,
HTCAPTION = 2,
HTCLIENT = 1,
HTCLOSE = 20,
HTGROWBOX = 4,
HTHSCROLL = 6,
HTLEFT = 10,
HTMAXBUTTON = 9,
HTMENU = 5,
HTMINBUTTON = 8,
HTNOWHERE = 0,
HTRIGHT = 11,
HTSYSMENU = 3,
HTTOP = 12,
HTTOPLEFT = 13,
HTTOPRIGHT = 14
}
[StructLayout(LayoutKind.Sequential)]
public struct LOGFONT
{
public long lfHeight;
public long lfWidth;
public long lfEscapement;
public long lfOrientation;
public long lfWeight;
public byte lfItalic;
public byte lfUnderline;
public byte lfStrikeOut;
public byte lfCharSet;
public byte lfOutPrecision;
public byte lfClipPrecision;
public byte lfQuality;
public byte lfPitchAndFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=0x20)]
public string lfFaceName;
}
public static class Message
{
public const int HWND_BROADCAST = 0xffff;
public const int WM_ACTIVATE = 6;
public const int WM_CAPTURECHANGED = 0x215;
public const int WM_CREATE = 1;
public const int WM_CTLCOLOREDIT = 0x133;
public const int WM_DESTROY = 2;
public const int WM_ERASEBKGND = 20;
public const int WM_GETMINMAXINFO = 0x24;
public const int WM_INITMENUPOPUP = 0x117;
public const int WM_KEYDOWN = 0x100;
public const int WM_KILLFOCUS = 8;
public const int WM_LBUTTONDOWN = 0x201;
public const int WM_LBUTTONUP = 0x202;
public const int WM_MOUSEACTIVATE = 0x21;
public const int WM_NCACTIVATE = 0x86;
public const int WM_NCCALCSIZE = 0x83;
public const int WM_NCHITTEST = 0x84;
public const int WM_NCLBUTTONDBLCLK = 0xa3;
public const int WM_NCLBUTTONDOWN = 0xa1;
public const int WM_NCLBUTTONUP = 0xa2;
public const int WM_NCMOUSEHOVER = 0x2a0;
public const int WM_NCMOUSELEAVE = 0x2a2;
public const int WM_NCMOUSEMOVE = 160;
public const int WM_NCPAINT = 0x85;
public const int WM_NCRBUTTONDOWN = 0xa4;
public const int WM_NCRBUTTONUP = 0xa5;
public const int WM_PAINT = 15;
public const int WM_PRINTCLIENT = 0x318;
public const int WM_RBUTTONDOWN = 0x204;
public const int WM_RBUTTONUP = 0x205;
public const int WM_SETFOCUS = 7;
public const int WM_SETTEXT = 12;
public const int WM_SYSCOMMAND = 0x112;
public const int WM_SYSKEYDOWN = 260;
public const int WM_SYSKEYUP = 0x105;
public const int WM_VSCROLL = 0x115;
public const int WM_WINDOWPOSCHANGED = 0x47;
public const int WM_WINDOWPOSCHANGING = 70;
}
[StructLayout(LayoutKind.Sequential)]
public struct MINMAXINFO
{
public InnerWin32.Point ptReserved;
public InnerWin32.Point ptMaxSize;
public InnerWin32.Point ptMaxPosition;
public InnerWin32.Point ptMinTrackSize;
public InnerWin32.Point ptMaxTrackSize;
}
[StructLayout(LayoutKind.Sequential)]
public struct NCCALCSIZE_PARAMS
{
public InnerWin32.RECT Rect0;
public InnerWin32.RECT Rect1;
public InnerWin32.RECT Rect2;
public int pWindowPos;
}
[StructLayout(LayoutKind.Sequential)]
public struct NonClientMetrics
{
public int cbSize;
public int iBorderWidth;
public int iScrollWidth;
public int iScrollHeight;
public int iCaptionWidth;
public int iCaptionHeight;
public InnerWin32.LOGFONT lfCaptionFont;
public int iSmCaptionWidth;
public int iSmCaptionHeight;
public InnerWin32.LOGFONT lfSmCaptionFont;
public int iMenuWidth;
public int iMenuHeight;
public InnerWin32.LOGFONT lfMenuFont;
public InnerWin32.LOGFONT lfStatusFont;
public InnerWin32.LOGFONT lfMessageFont;
public int iPaddedBorderWidth;
}
[StructLayout(LayoutKind.Sequential)]
public struct Point
{
public int x;
public int y;
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
public static class SC
{
public const int ARRANGE = 0xf110;
public const int CLOSE = 0xf060;
public const int CONTEXTHELP = 0xf180;
public const int DEFAULT = 0xf160;
public const int HOTKEY = 0xf150;
public const int HSCROLL = 0xf080;
public const int KEYMENU = 0xf100;
public const int MAXIMIZE = 0xf030;
public const int MINIMIZE = 0xf020;
public const int MONITORPOWER = 0xf170;
public const int MOUSEMENU = 0xf090;
public const int MOVE = 0xf010;
public const int NEXTWINDOW = 0xf040;
public const int PREVWINDOW = 0xf050;
public const int RESTORE = 0xf120;
public const int SCREENSAVE = 0xf140;
public const int SEPARATOR = 0xf00f;
public const int SIZE = 0xf000;
public const int TASKLIST = 0xf130;
public const int VSCROLL = 0xf070;
public const int WM_GETMINMAXINFO = 0x24;
}
public enum SystemMetric
{
SM_CXSCREEN,
SM_CYSCREEN,
SM_CXVSCROLL,
SM_CYHSCROLL,
SM_CYCAPTION,
SM_CXBORDER,
SM_CYBORDER,
SM_CXDLGFRAME,
SM_CYDLGFRAME,
SM_CYVTHUMB,
SM_CXHTHUMB,
SM_CXICON,
SM_CYICON,
SM_CXCURSOR,
SM_CYCURSOR,
SM_CYMENU,
SM_CXFULLSCREEN,
SM_CYFULLSCREEN,
SM_CYKANJIWINDOW,
SM_MOUSEPRESENT,
SM_CYVSCROLL,
SM_CXHSCROLL,
SM_DEBUG,
SM_SWAPBUTTON,
SM_RESERVED1,
SM_RESERVED2,
SM_RESERVED3,
SM_RESERVED4,
SM_CXMIN,
SM_CYMIN,
SM_CXSIZE,
SM_CYSIZE,
SM_CXFRAME,
SM_CYFRAME,
SM_CXMINTRACK,
SM_CYMINTRACK,
SM_CXDOUBLECLK,
SM_CYDOUBLECLK,
SM_CXICONSPACING,
SM_CYICONSPACING,
SM_MENUDROPALIGNMENT,
SM_PENWINDOWS,
SM_DBCSENABLED,
SM_CMOUSEBUTTONS
}
[Flags]
public enum TMEFalg
{
TME_LEAVE = 2,
TME_NONCLIENT = 0x10
}
[StructLayout(LayoutKind.Sequential)]
public class TRACKMOUSEEVENT
{
public int cbSize = Marshal.SizeOf(typeof(InnerWin32.TRACKMOUSEEVENT));
public int dwFlags;
public IntPtr hwndTrack;
public int dwHoverTime = SystemInformation.get_MouseHoverTime();
}
public enum UIACTION
{
SPI_GETBEEP = 1,
SPI_GETBORDER = 5,
SPI_GETFASTTASKSWITCH = 0x23,
SPI_GETGRIDGRANULARITY = 0x12,
SPI_GETICONTITLELOGFONT = 0x1f,
SPI_GETICONTITLEWRAP = 0x19,
SPI_GETKEYBOARDDELAY = 0x16,
SPI_GETKEYBOARDSPEED = 10,
SPI_GETMENUDROPALIGNMENT = 0x1b,
SPI_GETMOUSE = 3,
SPI_GETNONCLIENTMETRICS = 0x29,
SPI_GETSCREENSAVEACTIVE = 0x10,
SPI_GETSCREENSAVETIMEOUT = 14,
SPI_ICONHORIZONTALSPACING = 13,
SPI_ICONVERTICALSPACING = 0x18,
SPI_LANGDRIVER = 12,
SPI_SETBEEP = 2,
SPI_SETBORDER = 6,
SPI_SETDESKPATTERN = 0x15,
SPI_SETDESKWALLPAPER = 20,
SPI_SETDOUBLECLICKTIME = 0x20,
SPI_SETDOUBLECLKHEIGHT = 30,
SPI_SETDOUBLECLKWIDTH = 0x1d,
SPI_SETFASTTASKSWITCH = 0x24,
SPI_SETGRIDGRANULARITY = 0x13,
SPI_SETICONTITLELOGFONT = 0x22,
SPI_SETICONTITLEWRAP = 0x1a,
SPI_SETKEYBOARDDELAY = 0x17,
SPI_SETKEYBOARDSPEED = 11,
SPI_SETMENUDROPALIGNMENT = 0x1c,
SPI_SETMOUSE = 4,
SPI_SETMOUSEBUTTONSWAP = 0x21,
SPI_SETSCREENSAVEACTIVE = 0x11,
SPI_SETSCREENSAVETIMEOUT = 15
}
[StructLayout(LayoutKind.Sequential)]
public struct WINDOWPOS
{
public int hwnd;
public int hWndInsertAfter;
public int x;
public int y;
public int cx;
public int cy;
public int flags;
}
public class WindowStyle
{
public const int WS_CAPTION = 0xc00000;
public const int WS_SYSMENU = 0x80000;
}
public class WS
{
public const int WS_CAPTION = 0xc00000;
public const int WS_EX_DLGMODALFRAME = 1;
public const int WS_EX_WINDOWEDGE = 0x100;
public const int WS_SYSMENU = 0x80000;
public const int WS_THICKFRAME = 0x40000;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -