mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 22:13:23 -07:00
Fixing an overflow exception.
This commit is contained in:
parent
52c042572f
commit
fb965c2887
3 changed files with 9 additions and 9 deletions
|
@ -782,7 +782,9 @@ namespace Greenshot.Base.Core
|
|||
/// </summary>
|
||||
public WindowStyleFlags WindowStyle
|
||||
{
|
||||
get => (WindowStyleFlags) User32.GetWindowLongWrapper(Handle, (int) WindowLongIndex.GWL_STYLE);
|
||||
get => unchecked(
|
||||
(WindowStyleFlags)User32.GetWindowLongWrapper(Handle, (int)WindowLongIndex.GWL_STYLE).ToInt64()
|
||||
);
|
||||
set => User32.SetWindowLongWrapper(Handle, (int) WindowLongIndex.GWL_STYLE, new IntPtr((long) value));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Greenshot.Base.UnmanagedHelpers.Enums
|
|||
public enum WindowStyleFlags : int
|
||||
{
|
||||
//WS_OVERLAPPED = 0x00000000,
|
||||
WS_POPUP = -2147483648,
|
||||
WS_POPUP = -2147483648, // 0x80000000
|
||||
WS_CHILD = 0x40000000,
|
||||
WS_MINIMIZE = 0x20000000,
|
||||
WS_VISIBLE = 0x10000000,
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace Greenshot.Base.UnmanagedHelpers
|
|||
public static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32", SetLastError = true, EntryPoint = "GetWindowLong")]
|
||||
public static extern int GetWindowLong(IntPtr hWnd, int index);
|
||||
public static extern IntPtr GetWindowLong(IntPtr hWnd, int index);
|
||||
|
||||
[DllImport("user32", SetLastError = true, EntryPoint = "GetWindowLongPtr")]
|
||||
public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
|
||||
|
@ -276,16 +276,14 @@ namespace Greenshot.Base.UnmanagedHelpers
|
|||
/// <param name="hWnd"></param>
|
||||
/// <param name="nIndex"></param>
|
||||
/// <returns></returns>
|
||||
public static long GetWindowLongWrapper(IntPtr hWnd, int nIndex)
|
||||
public static IntPtr GetWindowLongWrapper(IntPtr hWnd, int nIndex)
|
||||
{
|
||||
if (IntPtr.Size == 8)
|
||||
{
|
||||
return GetWindowLongPtr(hWnd, nIndex).ToInt64();
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetWindowLong(hWnd, nIndex);
|
||||
return GetWindowLongPtr(hWnd, nIndex);
|
||||
}
|
||||
|
||||
return GetWindowLong(hWnd, nIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue