/// Copyright 2016 Kopano b.v. /// /// This program is free software: you can redistribute it and/or modify /// it under the terms of the GNU Affero General Public License, version 3, /// as published by the Free Software Foundation. /// /// This program is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the /// GNU Affero General Public License for more details. /// /// You should have received a copy of the GNU Affero General Public License /// along with this program.If not, see. /// /// Consult LICENSE file for details using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; namespace Acacia.Native { public static class User32 { [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern int RegisterClipboardFormat(string format); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr SetParent(IntPtr window, IntPtr parent); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr GetParent(IntPtr window); public static int WS_CHILD = 0x40000000; public enum GWL : int { MSGRESULT = 0, STYLE = -16 } [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int SetWindowLong(IntPtr hWnd, GWL gwl, int value); [DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr hWnd, GWL gwl); #region Messages [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam); [DllImport("user32.dll")] public static extern int PostMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam); #endregion #region DCs [DllImport("user32.dll")] public static extern IntPtr GetWindowDC(IntPtr hWnd); [DllImport("user32.dll")] public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); #endregion #region RedrawWindow [Flags()] public enum RedrawWindowFlags : uint { Invalidate = 0X1, InternalPaint = 0X2, Erase = 0X4, Validate = 0X8, NoInternalPaint = 0X10, NoErase = 0X20, NoChildren = 0X40, AllChildren = 0X80, UpdateNow = 0X100, EraseNow = 0X200, Frame = 0X400, NoFrame = 0X800 } [DllImport("user32.dll")] public static extern bool RedrawWindow(IntPtr hWnd, IntPtr lprcUpdate, IntPtr hrgnUpdate, RedrawWindowFlags flags); #endregion #region System metrics public enum SystemMetric : int { CXSCREEN = 0, CYSCREEN = 1, CXVSCROLL = 2, CYHSCROLL = 3, CYCAPTION = 4, CXBORDER = 5, CYBORDER = 6, CXDLGFRAME = 7, CYDLGFRAME = 8, CYVTHUMB = 9, CXHTHUMB = 10, CXICON = 11, CYICON = 12, CXCURSOR = 13, CYCURSOR = 14, CYMENU = 15, CXFULLSCREEN = 16, CYFULLSCREEN = 17, CYKANJIWINDOW = 18, MOUSEPRESENT = 19, CYVSCROLL = 20, CXHSCROLL = 21, DEBUG = 22, SWAPBUTTON = 23, RESERVED1 = 24, RESERVED2 = 25, RESERVED3 = 26, RESERVED4 = 27, CXMIN = 28, CYMIN = 29, CXSIZE = 30, CYSIZE = 31, CXFRAME = 32, CYFRAME = 33, CXMINTRACK = 34, CYMINTRACK = 35, CXDOUBLECLK = 36, CYDOUBLECLK = 37, CXICONSPACING = 38, CYICONSPACING = 39, MENUDROPALIGNMENT = 40, PENWINDOWS = 41, DBCSENABLED = 42, CMOUSEBUTTONS = 43, CXFIXEDFRAME = CXDLGFRAME, /* ;win40 name change */ CYFIXEDFRAME = CYDLGFRAME, /* ;win40 name change */ CXSIZEFRAME = CXFRAME, /* ;win40 name change */ CYSIZEFRAME = CYFRAME, /* ;win40 name change */ SECURE = 44, CXEDGE = 45, CYEDGE = 46, CXMINSPACING = 47, CYMINSPACING = 48, CXSMICON = 49, CYSMICON = 50, CYSMCAPTION = 51, CXSMSIZE = 52, CYSMSIZE = 53, CXMENUSIZE = 54, CYMENUSIZE = 55, ARRANGE = 56, CXMINIMIZED = 57, CYMINIMIZED = 58, CXMAXTRACK = 59, CYMAXTRACK = 60, CXMAXIMIZED = 61, CYMAXIMIZED = 62, NETWORK = 63, CLEANBOOT = 67, CXDRAG = 68, CYDRAG = 69, SHOWSOUNDS = 70, CXMENUCHECK = 71, /* Use instead of GetMenuCheckMarkDimensions()! */ CYMENUCHECK = 72, SLOWMACHINE = 73, MIDEASTENABLED = 74, MOUSEWHEELPRESENT = 75, XVIRTUALSCREEN = 76, YVIRTUALSCREEN = 77, CXVIRTUALSCREEN = 78, CYVIRTUALSCREEN = 79, CMONITORS = 80, SAMEDISPLAYFORMAT = 81, IMMENABLED = 82, CXFOCUSBORDER = 83, CYFOCUSBORDER = 84, TABLETPC = 86, MEDIACENTER = 87, STARTER = 88, SERVERR2 = 89, MOUSEHORIZONTALWHEELPRESENT = 91, CXPADDEDBORDER = 92, DIGITIZER = 94, MAXIMUMTOUCHES = 95, REMOTESESSION = 0x1000, SHUTTINGDOWN = 0x2000, REMOTECONTROL = 0x2001, CARETBLINKINGENABLED = 0x2002, CONVERTIBLESLATEMODE = 0x2003, SYSTEMDOCKED = 0x2004, } [DllImport("user32.dll")] public static extern int GetSystemMetrics(SystemMetric nIndex); #endregion } }