mirror of
https://github.com/greenshot/greenshot
synced 2025-08-13 02:07:07 -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,6 +48,7 @@ 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);
|
||||||
|
if(directUIWindowDetails != null) {
|
||||||
// Bring window to the front
|
// Bring window to the front
|
||||||
ieWindowDetails.Restore();
|
ieWindowDetails.Restore();
|
||||||
// Get accessible
|
// Get accessible
|
||||||
|
@ -55,6 +56,7 @@ namespace Greenshot.Helpers {
|
||||||
// Activate Tab
|
// Activate Tab
|
||||||
ieAccessible.ActivateIETab(tabIndex);
|
ieAccessible.ActivateIETab(tabIndex);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if the supplied window has a sub-window which covers more than the supplied percentage
|
/// Return true if the supplied window has a sub-window which covers more than the supplied percentage
|
||||||
|
@ -411,6 +413,7 @@ namespace Greenshot.Helpers {
|
||||||
|
|
||||||
// Store the URL of the page
|
// Store the URL of the page
|
||||||
if (documentContainer.Url != null) {
|
if (documentContainer.Url != null) {
|
||||||
|
try {
|
||||||
Uri uri = new Uri(documentContainer.Url);
|
Uri uri = new Uri(documentContainer.Url);
|
||||||
capture.CaptureDetails.AddMetaData("URL", uri.OriginalString);
|
capture.CaptureDetails.AddMetaData("URL", uri.OriginalString);
|
||||||
// As the URL can hardly be used in a filename, the following can be used
|
// As the URL can hardly be used in a filename, the following can be used
|
||||||
|
@ -430,6 +433,9 @@ namespace Greenshot.Helpers {
|
||||||
capture.CaptureDetails.AddMetaData("URL_USER", uri.UserInfo);
|
capture.CaptureDetails.AddMetaData("URL_USER", uri.UserInfo);
|
||||||
}
|
}
|
||||||
capture.CaptureDetails.AddMetaData("URL_PORT", uri.Port.ToString());
|
capture.CaptureDetails.AddMetaData("URL_PORT", uri.Port.ToString());
|
||||||
|
} catch(Exception e) {
|
||||||
|
LOG.Warn("Exception when trying to use url in metadata "+documentContainer.Url,e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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