This contains a fix for SUPPORT-288 which was suggested by Raymond Chen here: https://devblogs.microsoft.com/oldnewthing/20200302-00/?p=103507

This commit is contained in:
Robin 2020-03-03 08:14:16 +01:00
commit 9ebd4491af
11 changed files with 2006 additions and 1863 deletions

View file

@ -37,6 +37,7 @@ using System.Text.RegularExpressions;
using GreenshotPlugin.IniFile; using GreenshotPlugin.IniFile;
using GreenshotPlugin.Interfaces; using GreenshotPlugin.Interfaces;
using GreenshotPlugin.Interfaces.Plugin; using GreenshotPlugin.Interfaces.Plugin;
using GreenshotPlugin.UnmanagedHelpers;
using GreenshotPlugin.UnmanagedHelpers.Enums; using GreenshotPlugin.UnmanagedHelpers.Enums;
using log4net; using log4net;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,114 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using GreenshotPlugin.UnmanagedHelpers;
using System;
using System.Collections.Generic;
using System.Text;
namespace GreenshotPlugin.Core {
/// <summary>
/// EnumWindows wrapper for .NET
/// </summary>
public class WindowsEnumerator {
/// <summary>
/// Returns the collection of windows returned by GetWindows
/// </summary>
public IList<WindowDetails> Items { get; private set; }
/// <summary>
/// Gets all top level windows on the system.
/// </summary>
public WindowsEnumerator GetWindows() {
GetWindows(IntPtr.Zero, null);
return this;
}
/// <summary>
/// Gets all child windows of the specified window
/// </summary>
/// <param name="parent">Window Handle to get children for</param>
public WindowsEnumerator GetWindows(WindowDetails parent)
{
GetWindows(parent?.Handle ?? IntPtr.Zero, null);
return this;
}
/// <summary>
/// Gets all child windows of the specified window
/// </summary>
/// <param name="hWndParent">Window Handle to get children for</param>
/// <param name="classname">Window Classname to copy, use null to copy all</param>
public WindowsEnumerator GetWindows(IntPtr hWndParent, string classname) {
Items = new List<WindowDetails>();
IList<WindowDetails> windows = new List<WindowDetails>();
User32.EnumChildWindows(hWndParent, WindowEnum, IntPtr.Zero);
bool hasParent = !IntPtr.Zero.Equals(hWndParent);
string parentText = null;
if (hasParent) {
var title = new StringBuilder(260, 260);
User32.GetWindowText(hWndParent, title, title.Capacity);
parentText = title.ToString();
}
foreach (var window in Items) {
if (hasParent) {
window.Text = parentText;
window.ParentHandle = hWndParent;
}
if (classname == null || window.ClassName.Equals(classname)) {
windows.Add(window);
}
}
Items = windows;
return this;
}
/// <summary>
/// The enum Windows callback.
/// </summary>
/// <param name="hWnd">Window Handle</param>
/// <param name="lParam">Application defined value</param>
/// <returns>1 to continue enumeration, 0 to stop</returns>
private int WindowEnum(IntPtr hWnd, int lParam)
{
return OnWindowEnum(hWnd) ? 1 : 0;
}
/// <summary>
/// Called whenever a new window is about to be added
/// by the Window enumeration called from GetWindows.
/// If overriding this function, return true to continue
/// enumeration or false to stop. If you do not call
/// the base implementation the Items collection will
/// be empty.
/// </summary>
/// <param name="hWnd">Window handle to add</param>
/// <returns>True to continue enumeration, False to stop</returns>
protected bool OnWindowEnum(IntPtr hWnd) {
if (!WindowDetails.IsIgnoreHandle(hWnd)) {
Items.Add(new WindowDetails(hWnd));
}
return true;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -22,79 +22,17 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using GreenshotPlugin.Core;
using GreenshotPlugin.UnmanagedHelpers.Enums;
using GreenshotPlugin.UnmanagedHelpers.Structs; using GreenshotPlugin.UnmanagedHelpers.Structs;
using Microsoft.Win32; using Microsoft.Win32;
namespace GreenshotPlugin.UnmanagedHelpers.Enums { namespace GreenshotPlugin.UnmanagedHelpers {
// See: http://msdn.microsoft.com/en-us/library/aa969502(v=vs.85).aspx /// <summary>
[StructLayout(LayoutKind.Sequential)]
public struct DWM_THUMBNAIL_PROPERTIES {
// A bitwise combination of DWM thumbnail constant values that indicates which members of this structure are set.
public int dwFlags;
// The area in the destination window where the thumbnail will be rendered.
public RECT rcDestination;
// The region of the source window to use as the thumbnail. By default, the entire window is used as the thumbnail.
public RECT rcSource;
// The opacity with which to render the thumbnail. 0 is fully transparent while 255 is fully opaque. The default value is 255.
public byte opacity;
// TRUE to make the thumbnail visible; otherwise, FALSE. The default is FALSE.
public bool fVisible;
// TRUE to use only the thumbnail source's client area; otherwise, FALSE. The default is FALSE.
public bool fSourceClientAreaOnly;
public RECT Destination {
set {
dwFlags |= DWM_TNP_RECTDESTINATION;
rcDestination = value;
}
}
public RECT Source {
set {
dwFlags |= DWM_TNP_RECTSOURCE;
rcSource = value;
}
}
public byte Opacity {
set {
dwFlags |= DWM_TNP_OPACITY;
opacity = value;
}
}
public bool Visible {
set {
dwFlags |= DWM_TNP_VISIBLE;
fVisible = value;
}
}
public bool SourceClientAreaOnly {
set {
dwFlags |= DWM_TNP_SOURCECLIENTAREAONLY;
fSourceClientAreaOnly = value;
}
}
// A value for the rcDestination member has been specified.
public const int DWM_TNP_RECTDESTINATION = 0x00000001;
// A value for the rcSource member has been specified.
public const int DWM_TNP_RECTSOURCE = 0x00000002;
// A value for the opacity member has been specified.
public const int DWM_TNP_OPACITY = 0x00000004;
// A value for the fVisible member has been specified.
public const int DWM_TNP_VISIBLE = 0x00000008;
// A value for the fSourceClientAreaOnly member has been specified.
public const int DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010;
}
[StructLayout(LayoutKind.Sequential)]
public struct DWM_BLURBEHIND {
public DWM_BB dwFlags;
public bool fEnable;
public IntPtr hRgnBlur;
public bool fTransitionOnMaximized;
}
/// <summary>
/// Description of DWM. /// Description of DWM.
/// </summary> /// </summary>
public class DWM { public static class DWM {
public static readonly uint DWM_EC_DISABLECOMPOSITION = 0; public static readonly uint DWM_EC_DISABLECOMPOSITION = 0;
public static readonly uint DWM_EC_ENABLECOMPOSITION = 1; public static readonly uint DWM_EC_ENABLECOMPOSITION = 1;
@ -112,9 +50,11 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums {
[DllImport("dwmapi", SetLastError = true)] [DllImport("dwmapi", SetLastError = true)]
public static extern int DwmIsCompositionEnabled(out bool enabled); public static extern int DwmIsCompositionEnabled(out bool enabled);
[DllImport("dwmapi", SetLastError = true)] [DllImport("dwmapi", SetLastError = true)]
public static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out RECT lpRect, int size); public static extern int DwmGetWindowAttribute(IntPtr hWnd, DWMWINDOWATTRIBUTE dwAttribute, out RECT lpRect, int size);
[DllImport("dwmapi", SetLastError = true)]
public static extern int DwmGetWindowAttribute(IntPtr hWnd, DWMWINDOWATTRIBUTE dwAttribute, out bool pvAttribute, int cbAttribute);
[DllImport("dwmapi", SetLastError = true)] [DllImport("dwmapi", SetLastError = true)]
public static extern int DwmEnableBlurBehindWindow(IntPtr hwnd, ref DWM_BLURBEHIND blurBehind); public static extern int DwmEnableBlurBehindWindow(IntPtr hWnd, ref DWM_BLURBEHIND blurBehind);
[DllImport("dwmapi", SetLastError = true)] [DllImport("dwmapi", SetLastError = true)]
public static extern uint DwmEnableComposition(uint uCompositionAction); public static extern uint DwmEnableComposition(uint uCompositionAction);
@ -129,6 +69,22 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums {
private const string COLORIZATION_COLOR_KEY = @"SOFTWARE\Microsoft\Windows\DWM"; private const string COLORIZATION_COLOR_KEY = @"SOFTWARE\Microsoft\Windows\DWM";
/// <summary> /// <summary>
/// Checks if the window is cloaked, this should solve some issues with the window selection code
/// </summary>
/// <param name="hWnd">IntPtr as hWmd</param>
/// <returns>bool</returns>
public static bool IsWindowCloaked(IntPtr hWnd)
{
if (WindowsVersion.IsWindows8OrLater)
{
return false;
}
DwmGetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_CLOAKED, out bool isCloaked, sizeof(bool));
return isCloaked;
}
/// <summary>
/// Helper method for an easy DWM check /// Helper method for an easy DWM check
/// </summary> /// </summary>
/// <returns>bool true if DWM is available AND active</returns> /// <returns>bool true if DWM is available AND active</returns>
@ -136,10 +92,10 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums {
// According to: http://technet.microsoft.com/en-us/subscriptions/aa969538%28v=vs.85%29.aspx // According to: http://technet.microsoft.com/en-us/subscriptions/aa969538%28v=vs.85%29.aspx
// And: http://msdn.microsoft.com/en-us/library/windows/desktop/aa969510%28v=vs.85%29.aspx // And: http://msdn.microsoft.com/en-us/library/windows/desktop/aa969510%28v=vs.85%29.aspx
// DMW is always enabled on Windows 8! So return true and save a check! ;-) // DMW is always enabled on Windows 8! So return true and save a check! ;-)
if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 2) { if (WindowsVersion.IsWindows8OrLater) {
return true; return true;
} }
if (Environment.OSVersion.Version.Major >= 6) { if (WindowsVersion.IsWindowsVistaOrLater) {
DwmIsCompositionEnabled(out var dwmEnabled); DwmIsCompositionEnabled(out var dwmEnabled);
return dwmEnabled; return dwmEnabled;
} }

View file

@ -1,9 +1,31 @@
using System.Diagnostics.CodeAnalysis; /*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Diagnostics.CodeAnalysis;
namespace GreenshotPlugin.UnmanagedHelpers.Enums namespace GreenshotPlugin.UnmanagedHelpers.Enums
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum DWMWINDOWATTRIBUTE { public enum DWMWINDOWATTRIBUTE : uint
{
DWMWA_NCRENDERING_ENABLED = 1, DWMWA_NCRENDERING_ENABLED = 1,
DWMWA_NCRENDERING_POLICY, DWMWA_NCRENDERING_POLICY,
DWMWA_TRANSITIONS_FORCEDISABLED, DWMWA_TRANSITIONS_FORCEDISABLED,

View file

@ -1,4 +1,25 @@
using System; /*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
namespace GreenshotPlugin.UnmanagedHelpers.Enums namespace GreenshotPlugin.UnmanagedHelpers.Enums

View file

@ -0,0 +1,34 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Runtime.InteropServices;
namespace GreenshotPlugin.UnmanagedHelpers.Enums
{
[StructLayout(LayoutKind.Sequential)]
public struct DWM_BLURBEHIND {
public DWM_BB dwFlags;
public bool fEnable;
public IntPtr hRgnBlur;
public bool fTransitionOnMaximized;
}
}

View file

@ -0,0 +1,85 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Runtime.InteropServices;
using GreenshotPlugin.UnmanagedHelpers.Structs;
namespace GreenshotPlugin.UnmanagedHelpers.Enums
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/aa969502(v=vs.85).aspx
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct DWM_THUMBNAIL_PROPERTIES {
// A bitwise combination of DWM thumbnail constant values that indicates which members of this structure are set.
public int dwFlags;
// The area in the destination window where the thumbnail will be rendered.
public RECT rcDestination;
// The region of the source window to use as the thumbnail. By default, the entire window is used as the thumbnail.
public RECT rcSource;
// The opacity with which to render the thumbnail. 0 is fully transparent while 255 is fully opaque. The default value is 255.
public byte opacity;
// TRUE to make the thumbnail visible; otherwise, FALSE. The default is FALSE.
public bool fVisible;
// TRUE to use only the thumbnail source's client area; otherwise, FALSE. The default is FALSE.
public bool fSourceClientAreaOnly;
public RECT Destination {
set {
dwFlags |= DWM_TNP_RECTDESTINATION;
rcDestination = value;
}
}
public RECT Source {
set {
dwFlags |= DWM_TNP_RECTSOURCE;
rcSource = value;
}
}
public byte Opacity {
set {
dwFlags |= DWM_TNP_OPACITY;
opacity = value;
}
}
public bool Visible {
set {
dwFlags |= DWM_TNP_VISIBLE;
fVisible = value;
}
}
public bool SourceClientAreaOnly {
set {
dwFlags |= DWM_TNP_SOURCECLIENTAREAONLY;
fSourceClientAreaOnly = value;
}
}
// A value for the rcDestination member has been specified.
public const int DWM_TNP_RECTDESTINATION = 0x00000001;
// A value for the rcSource member has been specified.
public const int DWM_TNP_RECTSOURCE = 0x00000002;
// A value for the opacity member has been specified.
public const int DWM_TNP_OPACITY = 0x00000004;
// A value for the fVisible member has been specified.
public const int DWM_TNP_VISIBLE = 0x00000008;
// A value for the fSourceClientAreaOnly member has been specified.
public const int DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010;
}
}

View file

@ -1,4 +1,25 @@
using System.Diagnostics.CodeAnalysis; /*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Diagnostics.CodeAnalysis;
namespace GreenshotPlugin.UnmanagedHelpers.Enums namespace GreenshotPlugin.UnmanagedHelpers.Enums
{ {

View file

@ -116,36 +116,36 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern IntPtr GetClassLongPtr(IntPtr hWnd, int nIndex); public static extern IntPtr GetClassLongPtr(IntPtr hWnd, int nIndex);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PrintWindow(IntPtr hwnd, IntPtr hDC, uint nFlags); public static extern bool PrintWindow(IntPtr hwnd, IntPtr hDc, uint nFlags);
[DllImport("user32", CharSet=CharSet.Unicode, SetLastError=true)] [DllImport("user32", CharSet=CharSet.Unicode, SetLastError=true)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, IntPtr lParam); public static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, IntPtr lParam);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); public static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
[DllImport("user32", SetLastError = true, EntryPoint = "GetWindowLong")] [DllImport("user32", SetLastError = true, EntryPoint = "GetWindowLong")]
public static extern int GetWindowLong(IntPtr hwnd, int index); public static extern int GetWindowLong(IntPtr hWnd, int index);
[DllImport("user32", SetLastError = true, EntryPoint = "GetWindowLongPtr")] [DllImport("user32", SetLastError = true, EntryPoint = "GetWindowLongPtr")]
public static extern IntPtr GetWindowLongPtr(IntPtr hwnd, int nIndex); public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
[DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)] [DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern int SetWindowLong(IntPtr hWnd, int index, int styleFlags); public static extern int SetWindowLong(IntPtr hWnd, int index, int styleFlags);
[DllImport("user32", SetLastError = true, EntryPoint = "SetWindowLongPtr")] [DllImport("user32", SetLastError = true, EntryPoint = "SetWindowLongPtr")]
public static extern IntPtr SetWindowLongPtr(IntPtr hWnd, int index, IntPtr styleFlags); public static extern IntPtr SetWindowLongPtr(IntPtr hWnd, int index, IntPtr styleFlags);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern IntPtr MonitorFromWindow(IntPtr hwnd, MonitorFrom dwFlags); public static extern IntPtr MonitorFromWindow(IntPtr hWnd, MonitorFrom dwFlags);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern IntPtr MonitorFromRect([In] ref RECT lprc, uint dwFlags); public static extern IntPtr MonitorFromRect([In] ref RECT lprc, uint dwFlags);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowInfo(IntPtr hwnd, ref WindowInfo pwi); public static extern bool GetWindowInfo(IntPtr hWnd, ref WindowInfo pwi);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern int EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam); public static extern int EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern int EnumChildWindows(IntPtr hWndParent, EnumWindowsProc lpEnumFunc, IntPtr lParam); public static extern int EnumChildWindows(IntPtr hWndParent, EnumWindowsProc lpEnumFunc, IntPtr lParam);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi); public static extern bool GetScrollInfo(IntPtr hWnd, int fnBar, ref SCROLLINFO lpsi);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowScrollBar(IntPtr hwnd, ScrollBarDirection scrollBar, [MarshalAs(UnmanagedType.Bool)] bool show); public static extern bool ShowScrollBar(IntPtr hWnd, ScrollBarDirection scrollBar, [MarshalAs(UnmanagedType.Bool)] bool show);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern int SetScrollPos(IntPtr hWnd, Orientation nBar, int nPos, [MarshalAs(UnmanagedType.Bool)] bool bRedraw); public static extern int SetScrollPos(IntPtr hWnd, Orientation nBar, int nPos, [MarshalAs(UnmanagedType.Bool)] bool bRedraw);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
@ -157,10 +157,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern IntPtr GetTopWindow(IntPtr hWnd); public static extern IntPtr GetTopWindow(IntPtr hWnd);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern IntPtr GetDC(IntPtr hwnd); public static extern IntPtr GetDC(IntPtr hWnd);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC); public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDc);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern IntPtr GetClipboardOwner(); public static extern IntPtr GetClipboardOwner();