diff --git a/GreenshotPlugin/Core/WindowsHelper.cs b/GreenshotPlugin/Core/WindowsHelper.cs index 9dc0e9b9c..80a75d0a4 100644 --- a/GreenshotPlugin/Core/WindowsHelper.cs +++ b/GreenshotPlugin/Core/WindowsHelper.cs @@ -331,19 +331,19 @@ namespace GreenshotPlugin.Core { /// /// private static Icon GetAppIcon(IntPtr hwnd) { - const int ICON_SMALL = 0; - const int ICON_BIG = 1; - const int ICON_SMALL2 = 2; + IntPtr ICON_SMALL = IntPtr.Zero; + IntPtr ICON_BIG = new IntPtr(1); + IntPtr ICON_SMALL2 = new IntPtr(2); - IntPtr iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_SMALL2, 0); + IntPtr iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_SMALL2, IntPtr.Zero); if (iconHandle == IntPtr.Zero) { - iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_SMALL, 0); + iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_SMALL, IntPtr.Zero); } if (iconHandle == IntPtr.Zero) { iconHandle = User32.GetClassLongWrapper(hwnd, (int)ClassLongIndex.GCL_HICONSM); } if (iconHandle == IntPtr.Zero) { - iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_BIG, 0); + iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_BIG, IntPtr.Zero); } if (iconHandle == IntPtr.Zero) { iconHandle = User32.GetClassLongWrapper(hwnd, (int)ClassLongIndex.GCL_HICON); diff --git a/GreenshotPlugin/UnmanagedHelpers/User32.cs b/GreenshotPlugin/UnmanagedHelpers/User32.cs index 45ddf0ca7..232987a03 100644 --- a/GreenshotPlugin/UnmanagedHelpers/User32.cs +++ b/GreenshotPlugin/UnmanagedHelpers/User32.cs @@ -107,9 +107,9 @@ namespace GreenshotPlugin.UnmanagedHelpers { [return: MarshalAs(UnmanagedType.Bool)] public static extern bool PrintWindow(IntPtr hwnd, IntPtr hDC, uint nFlags); [DllImport("user32", SetLastError=true)] - public extern static int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam); - [DllImport("user32", SetLastError=true, EntryPoint = "SendMessageA")] - public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam); + public extern static IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, IntPtr lParam); + [DllImport("user32", SetLastError = true)] + public extern static IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); [DllImport("user32", SetLastError = true)] public extern static uint GetWindowLong(IntPtr hwnd, int index); [DllImport("user32", SetLastError = true)]