mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 05:53:27 -07:00
Fixed a potential issue with GetWindowLong, using a wrapper which decides upon the IntPtr size which call needs to be made.
Fixed the corner cut to work with a CreateRoundRectRgn, but made if it cuts configurable so people can turn it off. Added a CountColor method to ImageHelper.cs, which should be used to check if PrintWindow functions properly. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2236 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
0fd12ae5fc
commit
197d46c9b9
5 changed files with 71 additions and 68 deletions
|
@ -45,6 +45,8 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
public static extern int GetClipBox(IntPtr hdc, out RECT lprc);
|
||||
[DllImport("gdi32", SetLastError = true)]
|
||||
public static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos);
|
||||
[DllImport("gdi32")]
|
||||
public static extern IntPtr CreateRoundRectRgn(int x1, int y1, int x2, int y2, int cx, int cy);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 2)]
|
||||
|
|
|
@ -353,7 +353,21 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
[DllImport("user32", SetLastError = true)]
|
||||
public static extern int SetWindowLong(IntPtr hWnd, int index, uint styleFlags);
|
||||
[DllImport("user32", EntryPoint="GetWindowLongPtr", SetLastError=true)]
|
||||
public extern static IntPtr GetWindowLongPtr(IntPtr hwnd, int nIndex);
|
||||
public extern static uint GetWindowLongPtr(IntPtr hwnd, int nIndex);
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for the GetWindowLong which decides if the system is 64-bit or not and calls the right one.
|
||||
/// </summary>
|
||||
/// <param name="hwnd"></param>
|
||||
/// <param name="nIndex"></param>
|
||||
/// <returns></returns>
|
||||
public static uint GetWindowLongWrapper(IntPtr hwnd, int nIndex) {
|
||||
if (IntPtr.Size == 8) {
|
||||
return GetWindowLongPtr(hwnd, nIndex);
|
||||
} else {
|
||||
return GetWindowLong(hwnd, nIndex);
|
||||
}
|
||||
}
|
||||
[DllImport("user32", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool GetWindowInfo(IntPtr hwnd, ref WindowInfo pwi);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue