mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Refactored code location of the isGDIAllowed/isDWMAllowed, also changed the timeout for getting the HTML object from a window to 5 Seconds (instead of 1).
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1877 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
efd2861e35
commit
cac99fbaf3
5 changed files with 54 additions and 52 deletions
|
@ -27,6 +27,8 @@ using System.Windows.Forms;
|
|||
|
||||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.UnmanagedHelpers;
|
||||
using System.Diagnostics;
|
||||
using Greenshot.IniFile;
|
||||
|
||||
namespace GreenshotPlugin.Core {
|
||||
/// <summary>
|
||||
|
@ -444,6 +446,7 @@ namespace GreenshotPlugin.Core {
|
|||
/// </summary>
|
||||
public class WindowCapture {
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WindowCapture));
|
||||
private static CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>();
|
||||
|
||||
private WindowCapture() {
|
||||
}
|
||||
|
@ -550,6 +553,48 @@ namespace GreenshotPlugin.Core {
|
|||
return exceptionToThrow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to check if it is allowed to capture the process using DWM
|
||||
/// </summary>
|
||||
/// <param name="process">Process owning the window</param>
|
||||
/// <returns>true if it's allowed</returns>
|
||||
public static bool isDWMAllowed(Process process) {
|
||||
if (process != null) {
|
||||
if (conf.NoDWMCaptureForProduct != null && conf.NoDWMCaptureForProduct.Count > 0) {
|
||||
try {
|
||||
string productName = process.MainModule.FileVersionInfo.ProductName;
|
||||
if (productName != null && conf.NoDWMCaptureForProduct.Contains(productName.ToLower())) {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.Warn(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to check if it is allowed to capture the process using GDI
|
||||
/// </summary>
|
||||
/// <param name="processName">Process owning the window</param>
|
||||
/// <returns>true if it's allowed</returns>
|
||||
public static bool isGDIAllowed(Process process) {
|
||||
if (process != null) {
|
||||
if (conf.NoGDICaptureForProduct != null && conf.NoGDICaptureForProduct.Count > 0) {
|
||||
try {
|
||||
string productName = process.MainModule.FileVersionInfo.ProductName;
|
||||
if (productName != null && conf.NoGDICaptureForProduct.Contains(productName.ToLower())) {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.Warn(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method will use User32 code to capture the specified captureBounds from the screen
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue