mirror of
https://github.com/greenshot/greenshot
synced 2025-07-30 03:30:02 -07:00
two fixes to avoid exceptions when trying to capture IE content from IE instances embedded in other applications
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2043 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
8edfc71c9c
commit
b6a686db28
1 changed files with 30 additions and 24 deletions
|
@ -48,12 +48,14 @@ namespace Greenshot.Helpers {
|
||||||
// Helper method to activate a certain IE Tab
|
// Helper method to activate a certain IE Tab
|
||||||
public static void ActivateIETab(WindowDetails ieWindowDetails, int tabIndex) {
|
public static void ActivateIETab(WindowDetails ieWindowDetails, int tabIndex) {
|
||||||
WindowDetails directUIWindowDetails = IEHelper.GetDirectUI(ieWindowDetails);
|
WindowDetails directUIWindowDetails = IEHelper.GetDirectUI(ieWindowDetails);
|
||||||
// Bring window to the front
|
if(directUIWindowDetails != null) {
|
||||||
ieWindowDetails.Restore();
|
// Bring window to the front
|
||||||
// Get accessible
|
ieWindowDetails.Restore();
|
||||||
Accessible ieAccessible = new Accessible(directUIWindowDetails.Handle);
|
// Get accessible
|
||||||
// Activate Tab
|
Accessible ieAccessible = new Accessible(directUIWindowDetails.Handle);
|
||||||
ieAccessible.ActivateIETab(tabIndex);
|
// Activate Tab
|
||||||
|
ieAccessible.ActivateIETab(tabIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -411,25 +413,29 @@ namespace Greenshot.Helpers {
|
||||||
|
|
||||||
// Store the URL of the page
|
// Store the URL of the page
|
||||||
if (documentContainer.Url != null) {
|
if (documentContainer.Url != null) {
|
||||||
Uri uri = new Uri(documentContainer.Url);
|
try {
|
||||||
capture.CaptureDetails.AddMetaData("URL", uri.OriginalString);
|
Uri uri = new Uri(documentContainer.Url);
|
||||||
// As the URL can hardly be used in a filename, the following can be used
|
capture.CaptureDetails.AddMetaData("URL", uri.OriginalString);
|
||||||
if (!string.IsNullOrEmpty(uri.Scheme)) {
|
// As the URL can hardly be used in a filename, the following can be used
|
||||||
capture.CaptureDetails.AddMetaData("URL_SCHEME", uri.Scheme);
|
if (!string.IsNullOrEmpty(uri.Scheme)) {
|
||||||
|
capture.CaptureDetails.AddMetaData("URL_SCHEME", uri.Scheme);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(uri.DnsSafeHost)) {
|
||||||
|
capture.CaptureDetails.AddMetaData("URL_HOSTNAME", uri.DnsSafeHost);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(uri.AbsolutePath)) {
|
||||||
|
capture.CaptureDetails.AddMetaData("URL_PATH", uri.AbsolutePath);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(uri.Query)) {
|
||||||
|
capture.CaptureDetails.AddMetaData("URL_QUERY", uri.Query);
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(uri.UserInfo)) {
|
||||||
|
capture.CaptureDetails.AddMetaData("URL_USER", uri.UserInfo);
|
||||||
|
}
|
||||||
|
capture.CaptureDetails.AddMetaData("URL_PORT", uri.Port.ToString());
|
||||||
|
} catch(Exception e) {
|
||||||
|
LOG.Warn("Exception when trying to use url in metadata "+documentContainer.Url,e);
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(uri.DnsSafeHost)) {
|
|
||||||
capture.CaptureDetails.AddMetaData("URL_HOSTNAME", uri.DnsSafeHost);
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(uri.AbsolutePath)) {
|
|
||||||
capture.CaptureDetails.AddMetaData("URL_PATH", uri.AbsolutePath);
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(uri.Query)) {
|
|
||||||
capture.CaptureDetails.AddMetaData("URL_QUERY", uri.Query);
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(uri.UserInfo)) {
|
|
||||||
capture.CaptureDetails.AddMetaData("URL_USER", uri.UserInfo);
|
|
||||||
}
|
|
||||||
capture.CaptureDetails.AddMetaData("URL_PORT", uri.Port.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only move the mouse to correct for the capture offset
|
// Only move the mouse to correct for the capture offset
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue