From 7f3f676f6d381f8d9a994001219374dd04548f9b Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Mon, 20 Nov 2023 10:05:09 +0000 Subject: [PATCH 1/3] Removed unused code. Indentation. Signed-off-by: Konstantina Chremmou --- XenAdmin/Controls/SnapshotTreeView.cs | 39 ---- .../Controls/TreeViews/FlickerFreeTreeView.cs | 12 +- XenCenterLib/Win32.cs | 181 +----------------- 3 files changed, 15 insertions(+), 217 deletions(-) diff --git a/XenAdmin/Controls/SnapshotTreeView.cs b/XenAdmin/Controls/SnapshotTreeView.cs index 52cfe9ef64..4e2b9b2aed 100644 --- a/XenAdmin/Controls/SnapshotTreeView.cs +++ b/XenAdmin/Controls/SnapshotTreeView.cs @@ -288,7 +288,6 @@ protected override void OnLayout(LayoutEventArgs levent) { //This is needed to maximize and minimize properly, there is some issue in the ListView Control Win32.POINT pt = new Win32.POINT(); - IntPtr hResult = SendMessage(Handle, LVM_GETORIGIN, IntPtr.Zero, ref pt); origin = pt; root.InvalidateAll(); @@ -328,13 +327,9 @@ private void PositionSnapshots(SnapshotIcon icon, int x, int y) // Debugger.Break(); } } - public const int LVM_GETORIGIN = 0x1000 + 41; private Win32.POINT origin = new Win32.POINT(); - [DllImport("user32.dll")] - internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, ref Win32.POINT pt); - #endregion #region Drawing @@ -379,9 +374,6 @@ protected override void WndProc(ref Message m) } } - - - private const int WS_HSCROLL = 0x100000; private const int WS_VSCROLL = 0x200000; private const int GWL_STYLE = (-16); @@ -406,7 +398,6 @@ internal static bool IsHorizontalScrollBarVisible(Control ctrl) return (GetWindowLong(ctrl.Handle, GWL_STYLE) & WS_HSCROLL) != 0; } - private void SnapshotTreeView_DrawItem(object sender, DrawListViewItemEventArgs e) { @@ -432,34 +423,6 @@ private void SnapshotTreeView_DrawItem(object sender, DrawListViewItemEventArgs } - public void DrawRoundRect(Graphics g, Brush b, float x, float y, float width, float height, float radius) - { - - GraphicsPath gp = new GraphicsPath(); - - gp.AddLine(x + radius, y, x + width - (radius * 2), y); // Line - - gp.AddArc(x + width - (radius * 2), y, radius * 2, radius * 2, 270, 90); // Corner - - gp.AddLine(x + width, y + radius, x + width, y + height - (radius * 2)); // Line - - gp.AddArc(x + width - (radius * 2), y + height - (radius * 2), radius * 2, radius * 2, 0, 90); // Corner - gp.AddLine(x + width - (radius * 2), y + height, x + radius, y + height); // Line - - gp.AddArc(x, y + height - (radius * 2), radius * 2, radius * 2, 90, 90); // Corner - - gp.AddLine(x, y + height - (radius * 2), x, y + radius); // Line - - gp.AddArc(x, y, radius * 2, radius * 2, 180, 90); // Corner - - gp.CloseFigure(); - - - - g.FillPath(b, gp); - - } - private void DrawDate(DrawListViewItemEventArgs e, SnapshotIcon icon, bool background) { @@ -534,8 +497,6 @@ private void PaintLine(Graphics g, SnapshotIcon icon, SnapshotIcon child, bool h } } - - #endregion private string _spinningMessage = ""; diff --git a/XenAdmin/Controls/TreeViews/FlickerFreeTreeView.cs b/XenAdmin/Controls/TreeViews/FlickerFreeTreeView.cs index c26ff2abe7..c67f59f6e7 100644 --- a/XenAdmin/Controls/TreeViews/FlickerFreeTreeView.cs +++ b/XenAdmin/Controls/TreeViews/FlickerFreeTreeView.cs @@ -82,6 +82,7 @@ protected override void OnAfterExpand(VirtualTreeViewEventArgs e) protected override void WndProc(ref Message m) { + //Prevent Redraw background on paint if (m.Msg == Win32.WM_ERASEBKGND) { m.Result = IntPtr.Zero; @@ -322,16 +323,17 @@ public bool TryToSelectNewNode(Predicate tagMatch, bool selectNode, bool { if (selectNode) SelectedNode = node; - + if (expandNode) - node.Expand(); - + node.Expand(); + if (ensureNodeVisible) - node.EnsureVisible(); - + node.EnsureVisible(); + return true; } } + return false; } diff --git a/XenCenterLib/Win32.cs b/XenCenterLib/Win32.cs index d3df837e62..f5a0744035 100644 --- a/XenCenterLib/Win32.cs +++ b/XenCenterLib/Win32.cs @@ -55,7 +55,7 @@ public static class Win32 /// - Other USER objects (windows, menus) /// [DllImport("User32")] - extern public static int GetGuiResources(IntPtr hProcess, int uiFlags); + public static extern int GetGuiResources(IntPtr hProcess, int uiFlags); public static int GetGuiResourcesGDICount(IntPtr processHandle) { @@ -69,7 +69,7 @@ public static int GetGuiResourcesUserCount(IntPtr processHandle) public const int TO_UNICODE_BUFFER_SIZE = 64; [DllImport("user32.dll")] - public extern static int ToUnicode(uint wVirtKey, uint wScanCode, IntPtr lpKeyState, + public static extern int ToUnicode(uint wVirtKey, uint wScanCode, IntPtr lpKeyState, [Out, MarshalAs(UnmanagedType.LPWStr, SizeConst = TO_UNICODE_BUFFER_SIZE)] StringBuilder pwszBuff, int cchBuff, uint wFlags); @@ -78,137 +78,30 @@ public extern static int ToUnicode(uint wVirtKey, uint wScanCode, IntPtr lpKeySt public static extern bool FlushFileBuffers(Microsoft.Win32.SafeHandles.SafeFileHandle hFile); [DllImport("user32.dll")] - public extern static bool GetKeyboardState(IntPtr lpKeyState); - - // So we can flash minimized windows in the taskbar to alert the user. - // See http://pinvoke.net/default.aspx/user32.FlashWindowEx and - // http://blogs.msdn.com/hippietim/archive/2006/03/28/563094.aspx - [DllImport("user32.dll")] - public static extern Int32 FlashWindowEx(ref FLASHWINFO pwfi); - - [StructLayout(LayoutKind.Sequential)] - public struct FLASHWINFO - { - public UInt32 cbSize; - public IntPtr hwnd; - public UInt32 dwFlags; - public UInt32 uCount; - public UInt32 dwTimeout; - } - - /// - /// Stop flashing. The system restores the window to its original state. - /// - public const UInt32 FLASHW_STOP = 0; - /// - /// Flash the window caption. - /// - public const UInt32 FLASHW_CAPTION = 1; - /// - /// Flash the taskbar button. - /// - public const UInt32 FLASHW_TRAY = 2; - /// - /// Flash both the window caption and taskbar button = FLASHW_CAPTION | FLASHW_TRAY flags. - /// - public const UInt32 FLASHW_ALL = FLASHW_CAPTION | FLASHW_TRAY; - /// - /// Flash continuously, until the FLASHW_STOP flag is set. - /// - public const UInt32 FLASHW_TIMER = 4; - /// - /// Flash continuously until the window comes to the foreground. - /// - public const UInt32 FLASHW_TIMERNOFG = 12; - - /// - /// Flash the taskbar button for the given window. - /// - public static void FlashTaskbar(IntPtr hwnd) - { - FLASHWINFO fwi = new FLASHWINFO(); - fwi.cbSize = (UInt32)Marshal.SizeOf(typeof(FLASHWINFO)); - fwi.dwFlags = FLASHW_TRAY; - fwi.dwTimeout = 0; // The default, which is the caret blink rate - fwi.uCount = 3; - fwi.hwnd = hwnd; - FlashWindowEx(ref fwi); - } - - /// - /// Stop the given window flashing. - /// - public static void StopFlashing(IntPtr hwnd) - { - FLASHWINFO fwi = new FLASHWINFO(); - fwi.cbSize = (UInt32)Marshal.SizeOf(typeof(FLASHWINFO)); - fwi.dwFlags = FLASHW_STOP; - fwi.dwTimeout = 0; - fwi.uCount = 0; - fwi.hwnd = hwnd; - FlashWindowEx(ref fwi); - } - - [DllImport("user32.dll")] - public extern static IntPtr GetClipboardViewer(); + public static extern bool GetKeyboardState(IntPtr lpKeyState); [DllImport("user32.dll", SetLastError = true)] - public extern static IntPtr SetClipboardViewer(IntPtr hWnd); + public static extern IntPtr SetClipboardViewer(IntPtr hWnd); [DllImport("user32.dll", SetLastError = true)] - public extern static bool ChangeClipboardChain(IntPtr hWnd, IntPtr hWndNext); + public static extern bool ChangeClipboardChain(IntPtr hWnd, IntPtr hWndNext); /// /// There is not enough space on the disk. See winerror.h. /// - public const UInt32 ERROR_DISK_FULL = 112; - - public const int CBN_CLOSEUP = 8; - public const int EN_KILLFOCUS = 512; + public const uint ERROR_DISK_FULL = 112; public const int WM_DESTROY = 2; - public const int WM_ACTIVATE = 6; - /// - /// Sent when a control gains focus: see VNCGraphicsClient. - /// - public const int WM_SETFOCUS = 7; - public const int WM_GETTEXT = 13; - public const int WM_GETTEXTLENGTH = 14; - public const int WM_PAINT = 15; - /// - /// Prevent Redraw background on paint - /// public const int WM_ERASEBKGND = 20; - public const int WM_ACTIVATEAPP = 28; - public const int WM_SETCURSOR = 32; - public const int WM_MOUSEACTIVATE = 33; - public const int WM_WINDOWPOSCHANGING = 70; - public const int WM_WINDOWPOSCHANGED = 71; public const int WM_NOTIFY = 78; - public const int WM_NCHITTEST = 132; - public const int WM_NCPAINT = 133; - public const int WM_NCACTIVATE = 134; - public const int WM_TIMER = 275; public const int WM_VSCROLL = 277; public const int WM_KEYDOWN = 0x100; - public const int WM_KEYUP = 0x101; // Mouse Hooks - public const int HC_ACTION = 0; - public const int WH_MOUSE_LL = 14; - public const int WM_MOUSEMOVE = 0x200; public const int WM_LBUTTONDOWN = 0x201; - public const int WM_LBUTTONUP = 0x202; public const int WM_LBUTTONDBLCLK = 0x203; - public const int WM_RBUTTONDOWN = 0x204; - public const int WM_RBUTTONUP = 0x205; - public const int WM_RBUTTONDBLCLK = 0x206; - public const int WM_MBUTTONDOWN = 0x207; - public const int WM_MBUTTONUP = 0x208; - public const int WM_MBUTTONDBLCLK = 0x209; public const int WM_MOUSEWHEEL = 0x20A; - public const int WM_MOUSEHWHEEL = 0x20E; public const int WM_SYSKEYDOWN = 0x104; public const int WM_PARENTNOTIFY = 0x210; @@ -223,25 +116,17 @@ public static void StopFlashing(IntPtr hwnd) public const int WM_HSCROLL = 0x114; - public const int OCM_DRAWITEM = 8235; - public const int OCM_NOTIFY = 8270; - public const int OFN_ENABLEHOOK = 0x00000020; public const int OFN_EXPLORER = 0x00080000; - public const int OFN_FILEMUSTEXIST = 0x00001000; public const int OFN_HIDEREADONLY = 0x00000004; - public const int OFN_CREATEPROMPT = 0x00002000; public const int OFN_NOTESTFILECREATE = 0x00010000; public const int OFN_OVERWRITEPROMPT = 0x00000002; public const int OFN_PATHMUSTEXIST = 0x00000800; public const int OFN_SHOWHELP = 0x00000010; - public const int SWP_NOSIZE = 0x0001; - public const int SWP_NOMOVE = 0x0002; public const int SWP_NOZORDER = 0x0004; public const int BS_AUTOCHECKBOX = 0x0003; - public const int BS_PUSHBUTTON = 0x0000; public const int BM_SETCHECK = 0x00f1; public const int BM_GETCHECK = 0x00f0; @@ -288,9 +173,6 @@ public struct POINT [DllImport("user32.dll")] public static extern IntPtr GetParent(IntPtr hWnd); - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern bool SetWindowText(int hWnd, string lpString); - [DllImport("user32.dll")] public static extern bool DestroyWindow(IntPtr hwnd); @@ -378,12 +260,6 @@ public static string GetWindowsMessageName(int msg) return msg.ToString(); } - public delegate bool EnumUILanguagesProc(string lpUILanguageString, IntPtr lParam); - - [DllImport("kernel32.dll")] - public static extern bool EnumUILanguages(EnumUILanguagesProc pUILanguageEnumProc, - uint dwFlags, IntPtr lParam); - [DllImport("user32.dll")] public static extern int SetScrollPos(IntPtr hWnd, int nBar, int nPos, bool bRedraw); @@ -465,15 +341,6 @@ public enum ScrollBarConstants SB_BOTH = 3 } - public enum ScrollState - { - AutoScrolling = 0x0001, - HScrollVisible = 0x0002, - VScrollVisible = 0x0004, - UserHasScrolled = 0x0008, - FullDrag = 0x0010 - } - /// /// See http://msdn2.microsoft.com/en-us/library/e14hhbe6(VS.80).aspx /// @@ -487,18 +354,8 @@ public enum ScrollState [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetScrollInfo(IntPtr hWnd, int n, ref ScrollInfo lpScrollInfo); - [DllImport("user32.dll")] - public static extern int SetScrollInfo(IntPtr hwnd, int fnBar, [In] ref ScrollInfo lpsi, bool fRedraw); - #endregion - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); - - [return: MarshalAs(UnmanagedType.Bool)] - [DllImport("user32.dll", SetLastError = true)] - public static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); - [return: MarshalAs(UnmanagedType.Bool)] [DllImport("user32.dll")] public static extern bool PostMessageA(IntPtr hWnd, int nBar, int wParam, int lParam); @@ -535,8 +392,6 @@ public DiskSpaceInfo(UInt64 freeBytesAvailable, UInt64 totalBytes, bool isFAT) } } - public const int CP_NOCLOSE_BUTTON = 0x200; - public const int GWL_WNDPROC = -4; public delegate IntPtr WndProcDelegate(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); @@ -563,10 +418,10 @@ public DiskSpaceInfo(UInt64 freeBytesAvailable, UInt64 totalBytes, bool isFAT) public static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc); [DllImport("kernel32.dll", SetLastError = true)] - public extern static bool QueryPerformanceCounter(out long x); + public static extern bool QueryPerformanceCounter(out long x); [DllImport("kernel32.dll", SetLastError = true)] - public extern static bool QueryPerformanceFrequency(out long x); + public static extern bool QueryPerformanceFrequency(out long x); public delegate IntPtr OFNHookProcDelegate(IntPtr hdlg, int msg, IntPtr wParam, IntPtr lParam); @@ -613,18 +468,6 @@ public struct OPENFILENAME [DllImport("Comdlg32.dll")] public static extern int CommDlgExtendedError(); - /// - /// Extended message header for WM_NOTIFY - /// - [StructLayout(LayoutKind.Sequential)] - public struct NMHEADER - { - public NMHDR hdr; - public int iItem; - public int iButton; - public IntPtr pitem; - } - /// /// message header for WM_NOTIFY /// @@ -636,14 +479,6 @@ public struct NMHDR public int code; } - [StructLayout(LayoutKind.Sequential)] - public struct NMUPDOWN - { - public NMHDR hdr; - public int pos; - public int delta; - } - public const int S_OK = unchecked((int)0x00000000); public const int E_ACCESSDENIED = unchecked((int)0x80070005); public const int INET_E_DEFAULT_ACTION = unchecked((int)0x800C0011); From a5e14fee301a57e8ebdc3fae378d63bb1f9369c5 Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Mon, 20 Nov 2023 10:13:36 +0000 Subject: [PATCH 2/3] Removed duplicate declaration of SB_THUMBTRACK=5. Moved all constants in one region. Signed-off-by: Konstantina Chremmou --- XenAdmin/Controls/FlickerFreeListBox.cs | 2 +- XenCenterLib/Win32.cs | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/XenAdmin/Controls/FlickerFreeListBox.cs b/XenAdmin/Controls/FlickerFreeListBox.cs index 485051fbee..8a63462c6b 100644 --- a/XenAdmin/Controls/FlickerFreeListBox.cs +++ b/XenAdmin/Controls/FlickerFreeListBox.cs @@ -75,7 +75,7 @@ protected override void WndProc(ref Message msg) si.cbSize = (uint)Marshal.SizeOf(si); Win32.GetScrollInfo(msg.HWnd, 0, ref si); - if ((msg.WParam.ToInt32() & 0xFF) == Win32.SB_THUMBTRACK) + if ((msg.WParam.ToInt32() & 0xFF) == (int)Win32.ScrollBarCommands.SB_THUMBTRACK) { // If the user is in the middle of dragging the scrollbar, we're interested in // the 'track' position diff --git a/XenCenterLib/Win32.cs b/XenCenterLib/Win32.cs index f5a0744035..759763c8e6 100644 --- a/XenCenterLib/Win32.cs +++ b/XenCenterLib/Win32.cs @@ -86,6 +86,8 @@ public static extern int ToUnicode(uint wVirtKey, uint wScanCode, IntPtr lpKeySt [DllImport("user32.dll", SetLastError = true)] public static extern bool ChangeClipboardChain(IntPtr hWnd, IntPtr hWndNext); + #region Constants + /// /// There is not enough space on the disk. See winerror.h. /// @@ -141,6 +143,14 @@ public static extern int ToUnicode(uint wVirtKey, uint wScanCode, IntPtr lpKeySt public const int CDN_FILEOK = -606; public const int CDN_HELP = -605; + public const int GWL_WNDPROC = -4; + public const int LB_ITEMFROMPOINT = 425; + public const int S_OK = 0x0; + public const int E_ACCESSDENIED = unchecked((int)0x80070005); + public const int INET_E_DEFAULT_ACTION = unchecked((int)0x800C0011); + + #endregion + [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr GetDlgItem(IntPtr hDlg, int nIDDlgItem); @@ -341,11 +351,6 @@ public enum ScrollBarConstants SB_BOTH = 3 } - /// - /// See http://msdn2.microsoft.com/en-us/library/e14hhbe6(VS.80).aspx - /// - public const int SB_THUMBTRACK = 5; - /// /// See http://msdn2.microsoft.com/en-us/library/bb787583.aspx and /// http://pinvoke.net/default.aspx/user32/GetScrollInfo.html @@ -392,8 +397,6 @@ public DiskSpaceInfo(UInt64 freeBytesAvailable, UInt64 totalBytes, bool isFAT) } } - public const int GWL_WNDPROC = -4; - public delegate IntPtr WndProcDelegate(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); [DllImport("user32.dll", EntryPoint = "GetWindowLong")] @@ -405,8 +408,6 @@ public DiskSpaceInfo(UInt64 freeBytesAvailable, UInt64 totalBytes, bool isFAT) [DllImport("user32.dll")] public static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); - public const int LB_ITEMFROMPOINT = 425; - [DllImport("user32.dll")] public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect); @@ -479,10 +480,6 @@ public struct NMHDR public int code; } - public const int S_OK = unchecked((int)0x00000000); - public const int E_ACCESSDENIED = unchecked((int)0x80070005); - public const int INET_E_DEFAULT_ACTION = unchecked((int)0x800C0011); - [ComImport, Guid("6d5140c1-7436-11ce-8034-00aa006009fa"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComVisible(false)] From 25c9704ef1ec8fc0cad49a969e2ac0fe944f95a7 Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Mon, 20 Nov 2023 10:43:33 +0000 Subject: [PATCH 3/3] Allow splash screen to move. Signed-off-by: Konstantina Chremmou --- XenAdmin/SplashScreen.Designer.cs | 2 ++ XenAdmin/SplashScreen.cs | 20 ++++++++++++++++++++ XenCenterLib/Win32.cs | 12 ++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/XenAdmin/SplashScreen.Designer.cs b/XenAdmin/SplashScreen.Designer.cs index c264a8b3a7..88e1bf5d86 100644 --- a/XenAdmin/SplashScreen.Designer.cs +++ b/XenAdmin/SplashScreen.Designer.cs @@ -41,6 +41,7 @@ private void InitializeComponent() resources.ApplyResources(this.pictureBox1, "pictureBox1"); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.TabStop = false; + this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown); // // timer1 // @@ -52,6 +53,7 @@ private void InitializeComponent() this.labelCopyright.BackColor = System.Drawing.Color.Transparent; resources.ApplyResources(this.labelCopyright, "labelCopyright"); this.labelCopyright.Name = "labelCopyright"; + this.labelCopyright.MouseDown += new System.Windows.Forms.MouseEventHandler(this.labelCopyright_MouseDown); // // SplashScreen // diff --git a/XenAdmin/SplashScreen.cs b/XenAdmin/SplashScreen.cs index 00d2376d19..fc22f663e9 100644 --- a/XenAdmin/SplashScreen.cs +++ b/XenAdmin/SplashScreen.cs @@ -32,6 +32,7 @@ using System.Drawing; using System.Windows.Forms; using XenAdmin.Core; +using XenCenterLib; namespace XenAdmin { @@ -67,5 +68,24 @@ private void timer1_Tick(object sender, EventArgs e) timer1.Stop(); ShowMainWindowRequested?.Invoke(); } + + private void pictureBox1_MouseDown(object sender, MouseEventArgs e) + { + SendToForm(e.Button); + } + + private void labelCopyright_MouseDown(object sender, MouseEventArgs e) + { + SendToForm(e.Button); + } + + private void SendToForm(MouseButtons mouseButton) + { + if (mouseButton == MouseButtons.Left) + { + Win32.ReleaseCapture(); + Win32.SendMessage(Handle, Win32.WM_NCLBUTTONDOWN, Win32.HT_CAPTION, 0); + } + } } } diff --git a/XenCenterLib/Win32.cs b/XenCenterLib/Win32.cs index 759763c8e6..c39507e581 100644 --- a/XenCenterLib/Win32.cs +++ b/XenCenterLib/Win32.cs @@ -101,6 +101,8 @@ public static extern int ToUnicode(uint wVirtKey, uint wScanCode, IntPtr lpKeySt public const int WM_KEYDOWN = 0x100; // Mouse Hooks + public const int WM_NCLBUTTONDOWN = 0xA1; + public const int HT_CAPTION = 0x2; public const int WM_LBUTTONDOWN = 0x201; public const int WM_LBUTTONDBLCLK = 0x203; public const int WM_MOUSEWHEEL = 0x20A; @@ -186,11 +188,17 @@ public struct POINT [DllImport("user32.dll")] public static extern bool DestroyWindow(IntPtr hwnd); + [DllImport("user32.dll")] + public static extern bool ReleaseCapture(); + + [DllImport("user32.dll")] + public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam); + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] - public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); + public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] - public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, string lParam); + public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, string lParam); [DllImport("user32.dll")] public static extern IntPtr SetFocus(IntPtr hwnd);