Add function to send system commands to a window

This commit is contained in:
2015-06-13 07:59:51 -04:00
parent bffe0654ce
commit 00c0981034
2 changed files with 31 additions and 0 deletions

View File

@@ -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
{

View File

@@ -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