From 00c0981034d53b29cce6be8fc2625415075d3ce5 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Sat, 13 Jun 2015 07:59:51 -0400 Subject: [PATCH] Add function to send system commands to a window --- Constants.cs | 26 ++++++++++++++++++++++++++ Functions.cs | 5 +++++ 2 files changed, 31 insertions(+) diff --git a/Constants.cs b/Constants.cs index 2019d69..3b9197a 100644 --- a/Constants.cs +++ b/Constants.cs @@ -198,6 +198,32 @@ namespace Common.Native Restore = 9 } + public enum SysCommand + { + Size = 0xF000, + Move = 0xF010, + Minimize = 0xF020, + Maximize = 0xF030, + NextWindow = 0xF040, + PreviousWindow = 0xF050, + Close = 0xF060, + VerticalScroll = 0xF070, + HorizontalScroll = 0xF080, + MouseMenu = 0xF090, + KeyMenu = 0xF100, + Arrange = 0xF110, + Restore = 0xF120, + TaskList = 0xF130, + ScreenSave = 0xF140, + HotKey = 0xF150, + Default = 0xF160, + MonitorPower = 0xF170, + ContextHelp = 0xF180, + Separator = 0xF00F, + Icon = Minimize, + Zoom = Maximize, + } + [Flags] public enum SendMessageTimeoutFlags : uint { diff --git a/Functions.cs b/Functions.cs index 88f3b17..e2e8820 100644 --- a/Functions.cs +++ b/Functions.cs @@ -69,6 +69,11 @@ namespace Common.Native User32.SetWindowPlacement(hWnd, ref windowPlacement); } + public static void SystemCommand(IntPtr hWnd, Constants.SysCommand command) + { + User32.SendMessage(hWnd, (uint) Constants.WindowMessage.SysCommand, (IntPtr) command, IntPtr.Zero); + } + public static Icon GetSmallIcon(IntPtr hWnd) { try