From 567d9dc2f50f82396c76ddfa349f7dc5081c135b Mon Sep 17 00:00:00 2001 From: d3agle Date: Sat, 5 Sep 2015 12:16:10 -0500 Subject: [PATCH] Remote shell refactor --- Server/Core/Helper/NativeMethodsHelper.cs | 8 ++++++++ Server/Forms/FrmRemoteShell.cs | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Server/Core/Helper/NativeMethodsHelper.cs b/Server/Core/Helper/NativeMethodsHelper.cs index 1aa8420b..1c4efba4 100644 --- a/Server/Core/Helper/NativeMethodsHelper.cs +++ b/Server/Core/Helper/NativeMethodsHelper.cs @@ -8,6 +8,9 @@ public static class NativeMethodsHelper private const int LVM_FIRST = 0x1000; private const int LVM_SETITEMSTATE = LVM_FIRST + 43; + private const int WM_VSCROLL = 277; + private const int SB_PAGEBOTTOM = 7; + public static int MakeLong(int wLow, int wHigh) { int low = (int)IntLoWord(wLow); @@ -31,5 +34,10 @@ public static void SetItemState(IntPtr handle, int itemIndex, int mask, int valu }; NativeMethods.SendMessageLVItem(handle, LVM_SETITEMSTATE, itemIndex, ref lvItem); } + + public static void ScrollToBottom(IntPtr handle) + { + NativeMethods.SendMessage(handle, WM_VSCROLL, SB_PAGEBOTTOM, 0); + } } } diff --git a/Server/Forms/FrmRemoteShell.cs b/Server/Forms/FrmRemoteShell.cs index 8926c451..9dd5dc1e 100644 --- a/Server/Forms/FrmRemoteShell.cs +++ b/Server/Forms/FrmRemoteShell.cs @@ -3,7 +3,6 @@ using System.Drawing; using xServer.Core.Helper; using xServer.Core.Networking; -using xServer.Core.Utilities; namespace xServer.Forms { @@ -44,7 +43,7 @@ private void FrmRemoteShell_FormClosing(object sender, FormClosingEventArgs e) private void txtConsoleOutput_TextChanged(object sender, EventArgs e) { - NativeMethods.SendMessage(txtConsoleOutput.Handle, 277, 7, 0); + NativeMethodsHelper.ScrollToBottom(txtConsoleOutput.Handle); } private void txtConsoleInput_KeyDown(object sender, KeyEventArgs e)