mirror of
https://github.com/greenshot/greenshot
synced 2025-07-31 04:00:13 -07:00
Moving back to trunk!
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1602 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
ad265b2c54
commit
8d458998a1
332 changed files with 17647 additions and 9466 deletions
|
@ -19,13 +19,14 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace GreenshotPlugin.Core {
|
||||
/// <summary>
|
||||
/// Description of IEHelper.
|
||||
/// </summary>
|
||||
public class IEHelper {
|
||||
public static class IEHelper {
|
||||
// Internet explorer Registry key
|
||||
private const string IE_KEY = @"Software\Microsoft\Internet Explorer";
|
||||
/// <summary>
|
||||
|
@ -33,20 +34,65 @@ namespace GreenshotPlugin.Core {
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int IEVersion() {
|
||||
int version = 7;
|
||||
int version = 7;
|
||||
// Seeing if IE 9 is used, here we need another offset!
|
||||
using (RegistryKey ieKey = Registry.LocalMachine.OpenSubKey(IE_KEY, false)) {
|
||||
if (ieKey != null) {
|
||||
object versionKey = ieKey.GetValue("Version");
|
||||
if (versionKey != null) {
|
||||
int.TryParse(versionKey.ToString().Substring(0,1), out version);
|
||||
}
|
||||
}
|
||||
if (ieKey != null) {
|
||||
object versionKey = ieKey.GetValue("Version");
|
||||
if (versionKey != null) {
|
||||
int.TryParse(versionKey.ToString().Substring(0,1), out version);
|
||||
}
|
||||
}
|
||||
}
|
||||
return version;
|
||||
return version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find the DirectUI window for MSAA (Accessible)
|
||||
/// </summary>
|
||||
/// <param name="browserWindowDetails">The browser WindowDetails</param>
|
||||
/// <returns>WindowDetails for the DirectUI window</returns>
|
||||
public static WindowDetails GetDirectUI(WindowDetails browserWindowDetails) {
|
||||
WindowDetails tmpWD = browserWindowDetails;
|
||||
// Since IE 9 the TabBandClass is less deep!
|
||||
if (IEHelper.IEVersion() < 9) {
|
||||
tmpWD = tmpWD.GetChild("CommandBarClass");
|
||||
if (tmpWD != null) {
|
||||
tmpWD = tmpWD.GetChild("ReBarWindow32");
|
||||
}
|
||||
}
|
||||
if (tmpWD != null) {
|
||||
tmpWD = tmpWD.GetChild("TabBandClass");
|
||||
}
|
||||
if (tmpWD != null) {
|
||||
tmpWD = tmpWD.GetChild("DirectUIHWND");;
|
||||
}
|
||||
return tmpWD;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return an IEnumerable with the currently opened IE urls
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<string> GetIEUrls() {
|
||||
List<string> urls = new List<string>();
|
||||
// Find the IE window
|
||||
foreach (WindowDetails ieWindow in WindowDetails.GetAllWindows("IEFrame")) {
|
||||
WindowDetails directUIWD = GetDirectUI(ieWindow);
|
||||
if (directUIWD != null) {
|
||||
Accessible ieAccessible = new Accessible(directUIWD.Handle);
|
||||
List<string> ieUrls = ieAccessible.IETabUrls;
|
||||
if (ieUrls != null && ieUrls.Count > 0) {
|
||||
foreach(string url in ieUrls) {
|
||||
if (!urls.Contains(url)) {
|
||||
urls.Add(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEHelper() {
|
||||
return urls;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue