"Merged" 0.8 with HEAD, so we can continue developing

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1282 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2011-07-17 12:05:59 +00:00
commit f3b0878b02
539 changed files with 86855 additions and 0 deletions

View file

@ -0,0 +1,589 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Runtime.InteropServices;
using Greenshot.Helpers.IEInterop;
using GreenshotPlugin.Core;
namespace Greenshot.Helpers.IEInterop {
public class ElementContainer {
public Rectangle rectangle;
public string id;
public Dictionary<string, string> attributes = new Dictionary<string, string>();
}
public class DocumentContainer {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(DocumentContainer));
private static CoreConfiguration configuration = IniConfig.GetIniSection<CoreConfiguration>();
private const int E_ACCESSDENIED = unchecked((int)0x80070005L);
private static Guid IID_IWebBrowserApp = new Guid("0002DF05-0000-0000-C000-000000000046");
private static Guid IID_IWebBrowser2 = new Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E");
private static int counter = 0;
private int id = counter++;
private IHTMLDocument2 document2;
private IHTMLDocument3 document3;
private Point sourceLocation;
private Point destinationLocation;
private Point startLocation = Point.Empty;
private Rectangle viewportRectangle = Rectangle.Empty;
private string name;
private string url;
private bool isDTD;
private DocumentContainer parent;
private WindowDetails contentWindow;
private double zoomLevelX = 1;
private double zoomLevelY = 1;
private List<DocumentContainer> frames = new List<DocumentContainer>();
private DocumentContainer(IHTMLWindow2 frameWindow, WindowDetails contentWindow, DocumentContainer parent) {
//IWebBrowser2 webBrowser2 = frame as IWebBrowser2;
//IHTMLDocument2 document2 = webBrowser2.Document as IHTMLDocument2;
IHTMLDocument2 document2 = GetDocumentFromWindow(frameWindow);
try {
LOG.DebugFormat("frameWindow.name {0}", frameWindow.name);
} catch {
}
try {
LOG.DebugFormat("document2.url {0}",document2.url);
} catch {
}
try {
LOG.DebugFormat("document2.title {0}", document2.title);
} catch {
}
this.parent = parent;
// Calculate startLocation for the frames
IHTMLWindow3 window3 = (IHTMLWindow3)document2.parentWindow;
// IHTMLElement element = window2.document.body;
// long x = 0;
// long y = 0;
// do {
// x += element.offsetLeft;
// y += element.offsetTop;
// element = element.offsetParent;
// } while (element != null);
// startLocation = new Point((int)x, (int)y);
Point contentWindowLocation = contentWindow.ClientRectangle.Location;
int x = window3.screenLeft - contentWindowLocation.X;
int y = window3.screenTop - contentWindowLocation.Y;
startLocation = new Point(x, y);
Init(document2, contentWindow);
}
public DocumentContainer(IHTMLDocument2 document2, WindowDetails contentWindow) {
Init(document2, contentWindow);
LOG.DebugFormat("Creating DocumentContainer for Document {0} found in window with rectangle {1}", name, SourceRectangle);
}
/// <summary>
/// Private helper method for the constructors
/// </summary>
/// <param name="document2">IHTMLDocument2</param>
/// <param name="contentWindow">WindowDetails</param>
private void Init(IHTMLDocument2 document2, WindowDetails contentWindow) {
this.document2 = document2;
this.contentWindow = contentWindow;
this.document3 = document2 as IHTMLDocument3;
// Check what access method is needed for the document
IHTMLDocument5 document5 = (IHTMLDocument5)document2;
//compatibility mode affects how height is computed
if ((document3.documentElement != null) && (!document5.compatMode.Equals("BackCompat"))) {
isDTD = true;
} else {
isDTD = false;
}
Rectangle clientRectangle = contentWindow.ClientRectangle;
try {
IHTMLWindow3 window3 = (IHTMLWindow3)document2.parentWindow;
IHTMLWindow2 window2 = (IHTMLWindow2)document2.parentWindow;
IHTMLScreen2 screen2 = (IHTMLScreen2)window2.screen;
IHTMLScreen screen = window2.screen;
if (parent != null) {
// Copy parent values
zoomLevelX = parent.zoomLevelX;
zoomLevelY = parent.zoomLevelY;
viewportRectangle = parent.viewportRectangle;
} else {
//DisableScrollbars(document2);
// Calculate zoom level
zoomLevelX = (double)screen2.deviceXDPI/(double)screen2.logicalXDPI;
zoomLevelY = (double)screen2.deviceYDPI/(double)screen2.logicalYDPI;
// Calculate the viewport rectangle, needed if there is a frame around the html window
LOG.DebugFormat("Screen {0}x{1}", ScaleX(screen.width), ScaleY(screen.height));
LOG.DebugFormat("Screen location {0},{1}", window3.screenLeft, window3.screenTop);
LOG.DebugFormat("Window rectangle {0}", clientRectangle);
LOG.DebugFormat("Client size {0}x{1}", ClientWidth, ClientHeight);
int diffX = clientRectangle.Width - ClientWidth;
int diffY = clientRectangle.Height - ClientHeight;
// If there is a border around the inner window, the diff == 4
// If there is a border AND a scrollbar the diff == 20
if ((diffX == 4 || diffX >= 20) && (diffY == 4 || diffY >= 20)) {
Point viewportOffset = new Point(2, 2);
Size viewportSize = new Size(ClientWidth, ClientHeight);
viewportRectangle = new Rectangle(viewportOffset, viewportSize);
LOG.DebugFormat("viewportRect {0}", viewportRectangle);
}
}
LOG.DebugFormat("Zoomlevel {0}, {1}", zoomLevelX, zoomLevelY);
} catch (Exception e) {
LOG.Warn("Can't get certain properties for documents, using default. due to: ", e);
}
LOG.DebugFormat("Calculated location {0} for {1}", startLocation, document2.title);
sourceLocation = new Point(ScaleX((int)startLocation.X), ScaleY((int)startLocation.Y));
destinationLocation = new Point(ScaleX((int)startLocation.X), ScaleY((int)startLocation.Y));
name = document2.title;
url = document2.url;
if (parent != null) {
return;
}
IHTMLFramesCollection2 frameCollection = (IHTMLFramesCollection2)document2.frames;
for(int frame = 0; frame < frameCollection.length; frame++) {
IHTMLWindow2 frameWindow = frameCollection.item(frame);
try {
DocumentContainer frameData = new DocumentContainer(frameWindow, contentWindow, this);
// check if frame is hidden
if (!frameData.isHidden) {
LOG.DebugFormat("Creating DocumentContainer for Frame {0} found in window with rectangle {1}", frameData.name, frameData.SourceRectangle);
frames.Add(frameData);
} else {
LOG.DebugFormat("Skipping frame {0}", frameData.Name);
}
} catch (Exception e) {
LOG.Warn("Problem while trying to get information from a frame, skipping the frame!", e);
}
}
// Correct iframe locations
foreach (IHTMLElement frameElement in document3.getElementsByTagName("IFRAME")){
try {
CorrectFrameLocations(frameElement);
} catch (Exception e) {
LOG.Warn("Problem while trying to get information from an iframe, skipping the frame!", e);
}
}
}
private void DisableScrollbars(IHTMLDocument2 document2) {
try {
setAttribute("scroll","no");
IHTMLBodyElement body = (IHTMLBodyElement)document2.body;
body.scroll="no";
document2.body.style.borderStyle = "none";
} catch (Exception ex) {
LOG.Warn("Can't disable scroll", ex);
}
}
private void CorrectFrameLocations(IHTMLElement frameElement) {
long x = 0;
long y = 0;
IHTMLElement element = frameElement;
do {
x += element.offsetLeft;
y += element.offsetTop;
element = element.offsetParent;
} while (element != null);
Point elementLocation = new Point((int)x, (int)y);
IHTMLElement2 element2 = (IHTMLElement2)frameElement;
IHTMLRect rec = element2.getBoundingClientRect();
Point elementBoundingLocation = new Point(rec.left, rec.top);
LOG.DebugFormat("Looking for iframe to correct at {0}", elementBoundingLocation);
foreach(DocumentContainer foundFrame in frames) {
Point frameLocation = foundFrame.SourceLocation;
if (frameLocation.Equals(elementBoundingLocation)) {
// Match found, correcting location
LOG.DebugFormat("Correcting frame from {0} to {1}", frameLocation, elementLocation);
foundFrame.SourceLocation = elementLocation;
foundFrame.DestinationLocation = elementLocation;
} else {
LOG.DebugFormat("{0} != {1}", frameLocation, elementBoundingLocation);
}
}
}
/// <summary>
/// A "workaround" for Access Denied when dealing with Frames from different domains
/// </summary>
/// <param name="htmlWindow">The IHTMLWindow2 to get the document from</param>
/// <returns>IHTMLDocument2 or null</returns>
private static IHTMLDocument2 GetDocumentFromWindow(IHTMLWindow2 htmlWindow) {
if (htmlWindow == null) {
LOG.Warn("htmlWindow == null");
return null;
}
// First try the usual way to get the document.
try {
IHTMLDocument2 doc = htmlWindow.document;
return doc;
} catch (COMException comEx) {
// I think COMException won't be ever fired but just to be sure ...
if (comEx.ErrorCode != E_ACCESSDENIED) {
LOG.Warn("comEx.ErrorCode != E_ACCESSDENIED but", comEx);
return null;
}
} catch (System.UnauthorizedAccessException) {
// This error is okay, ignoring it
} catch (Exception ex1) {
LOG.Warn("Some error: ", ex1);
// Any other error.
return null;
}
// At this point the error was E_ACCESSDENIED because the frame contains a document from another domain.
// IE tries to prevent a cross frame scripting security issue.
try {
// Convert IHTMLWindow2 to IWebBrowser2 using IServiceProvider.
IServiceProvider sp = (IServiceProvider)htmlWindow;
// Use IServiceProvider.QueryService to get IWebBrowser2 object.
Object brws = null;
sp.QueryService(ref IID_IWebBrowserApp, ref IID_IWebBrowser2, out brws);
// Get the document from IWebBrowser2.
IWebBrowser2 browser = (IWebBrowser2)(brws);
return (IHTMLDocument2)browser.Document;
} catch (Exception ex2) {
LOG.Warn("another error: ", ex2);
}
return null;
}
/// <summary>
/// Wrapper around getElementsByTagName
/// </summary>
/// <param name="tagName">tagName is the name of the tag to look for, e.g. "input"</param>
/// <param name="retrieveAttributes">If true then all attributes are retrieved. This is slow!</param>
/// <returns></returns>
public List<ElementContainer> GetElementsByTagName(string tagName, string[] attributes) {
List<ElementContainer> elements = new List<ElementContainer>();
foreach(IHTMLElement element in document3.getElementsByTagName(tagName)) {
if (element.offsetWidth <= 0 || element.offsetHeight <= 0) {
// not visisble
continue;
}
ElementContainer elementContainer = new ElementContainer();
elementContainer.id = element.id;
if (attributes != null) {
foreach(string attributeName in attributes) {
object attributeValue = element.getAttribute(attributeName, 0);
if (attributeValue != null && attributeValue != DBNull.Value && !elementContainer.attributes.ContainsKey(attributeName)) {
elementContainer.attributes.Add(attributeName, attributeValue.ToString());
}
}
}
Point elementLocation = new Point((int)element.offsetLeft, (int)element.offsetTop);
elementLocation.Offset(this.DestinationLocation);
IHTMLElement parent = element.offsetParent;
while (parent != null) {
elementLocation.Offset((int)parent.offsetLeft, (int)parent.offsetTop);
parent = parent.offsetParent;
}
Rectangle elementRectangle = new Rectangle(elementLocation, new Size((int)element.offsetWidth, (int)element.offsetHeight));
elementContainer.rectangle = elementRectangle;
elements.Add(elementContainer);
}
return elements;
}
public Color BackgroundColor {
get {
if (document2.bgColor != null) {
string bgColorString = (string)document2.bgColor;
int rgbInt = Int32.Parse(bgColorString.Substring(1), NumberStyles.HexNumber);
Color bgColor = Color.FromArgb(rgbInt >> 16, (rgbInt >> 8) & 255, rgbInt & 255);
return bgColor;
}
return Color.White;
}
}
public Rectangle ViewportRectangle {
get {
return viewportRectangle;
}
}
public WindowDetails ContentWindow {
get {
return contentWindow;
}
}
public DocumentContainer Parent {
get {
return parent;
}
set {
parent = value;
}
}
private int ScaleX(int physicalValue) {
return (int)Math.Round(physicalValue * zoomLevelX, MidpointRounding.AwayFromZero);
}
private int ScaleY(int physicalValue) {
return (int)Math.Round(physicalValue * zoomLevelY, MidpointRounding.AwayFromZero);
}
private int UnscaleX(int physicalValue) {
return (int)Math.Round(physicalValue / zoomLevelX, MidpointRounding.AwayFromZero);
}
private int UnscaleY(int physicalValue) {
return (int)Math.Round(physicalValue / zoomLevelY, MidpointRounding.AwayFromZero);
}
/// <summary>
/// Set/change an int attribute on a document
/// </summary>
public void setAttribute(string attribute, int value) {
setAttribute(attribute, value.ToString());
}
/// <summary>
/// Set/change an attribute on a document
/// </summary>
/// <param name="attribute">Attribute to set</param>
/// <param name="value">Value to set</param>
/// <param name="document2">The IHTMLDocument2</param>
/// <param name="document3">The IHTMLDocument3</param>
public void setAttribute(string attribute, string value) {
if (!isDTD) {
document2.body.setAttribute(attribute, value, 1);
} else {
document3.documentElement.setAttribute(attribute, value, 1);
}
}
/// <summary>
/// Get the attribute from a document
/// </summary>
/// <param name="attribute">Attribute to get</param>
/// <param name="document2">The IHTMLDocument2</param>
/// <param name="document3">The IHTMLDocument3</param>
/// <returns>object with the attribute value</returns>
public object getAttribute(string attribute) {
object retVal = 0;
if (!isDTD) {
retVal = document2.body.getAttribute(attribute, 1);
} else {
retVal = document3.documentElement.getAttribute(attribute, 1);
}
return retVal;
}
/// <summary>
/// Get the attribute as int from a document
/// </summary>
public int getAttributeAsInt(string attribute) {
int retVal = (int)getAttribute(attribute);
return retVal;
}
public int ID {
get {
return id;
}
}
public string Name {
get {
return name;
}
}
public string Url {
get {
return url;
}
}
public bool isHidden {
get {
return ClientWidth == 0 || ClientHeight == 0;
}
}
public int ClientWidth {
get {
return ScaleX(getAttributeAsInt("clientWidth"));
}
}
public int ClientHeight {
get {
return ScaleY(getAttributeAsInt("clientHeight"));
}
}
public int ScrollWidth {
get {
return ScaleX(getAttributeAsInt("scrollWidth"));
}
}
public int ScrollHeight {
get {
return ScaleY(getAttributeAsInt("scrollHeight"));
}
}
public Point SourceLocation {
get {
return sourceLocation;
}
set {
sourceLocation = value;;
}
}
public Size SourceSize {
get {
return new Size(ClientWidth, ClientHeight);
}
}
public Rectangle SourceRectangle {
get {
return new Rectangle(SourceLocation, SourceSize);
}
}
public int SourceLeft {
get {
return sourceLocation.X;
}
}
public int SourceTop {
get {
return sourceLocation.Y;
}
}
public int SourceRight {
get {
return sourceLocation.X + ClientWidth;
}
}
public int SourceBottom {
get {
return sourceLocation.Y + ClientHeight;
}
}
public Point DestinationLocation {
get {
return destinationLocation;
}
set {
destinationLocation = value;;
}
}
public Size DestinationSize {
get {
return new Size(ScrollWidth, ScrollHeight);
}
}
public Rectangle DestinationRectangle {
get {
return new Rectangle(this.DestinationLocation, this.DestinationSize);
}
}
public int DestinationLeft {
get {
return destinationLocation.X;
}
set {
destinationLocation.X = value;
}
}
public int DestinationTop {
get {
return destinationLocation.Y;
}
set {
destinationLocation.Y = value;
}
}
public int DestinationRight {
get {
return destinationLocation.X + ScrollWidth;
}
}
public int DestinationBottom {
get {
return destinationLocation.Y + ScrollHeight;
}
}
public int ScrollLeft {
get{
return ScaleX(getAttributeAsInt("scrollLeft"));
}
set {
setAttribute("scrollLeft", UnscaleX(value));
}
}
public int ScrollTop {
get{
return ScaleY(getAttributeAsInt("scrollTop"));
}
set {
setAttribute("scrollTop", UnscaleY(value));
}
}
public List<DocumentContainer> Frames {
get {
return frames;
}
}
}
}

View file

@ -0,0 +1,37 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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.Collections;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
namespace Greenshot.Helpers.IEInterop {
[ComImport, Guid("3050F1D8-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLBodyElement {
string scroll {
set;
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
}
}

View file

@ -0,0 +1,38 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
/// <summary><para><c>IHTMLDocument</c> interface.</para></summary>
[Guid("626FC520-A41E-11CF-A731-00A0C9082637")]
[ComImport]
[TypeLibType(TypeLibTypeFlags.FDual)]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLDocument {
object Script {
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
}
}

View file

@ -0,0 +1,72 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
/// <summary><para><c>IHTMLDocument2</c> interface.</para></summary>
[Guid("332C4425-26CB-11D0-B483-00C04FD90119")]
[ComImport]
[TypeLibType(TypeLibTypeFlags.FDual)]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLDocument2 {
IHTMLElement body {
[DispId(1004)]
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
string title {
[DispId(1012)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
object frames {
[DispId(1019)]
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
string url {
[DispId(1025)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
IHTMLWindow2 parentWindow {
[DispId(1034)]
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
object bgColor {
[DispId(-501)]
get;
}
IHTMLSelectionObject selection {
[DispId(1017)]
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
}
}

View file

@ -0,0 +1,50 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
/// <summary><para><c>IHTMLDocument3</c> interface.</para></summary>
[Guid("3050F485-98B5-11CF-BB82-00AA00BDCE0B")]
[ComImport]
[TypeLibType(TypeLibTypeFlags.FDual)]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLDocument3 {
IHTMLElement documentElement {
[DispId(1075)]
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
[DispId(1086)]
[return: MarshalAs(UnmanagedType.IDispatch)]
IHTMLElementCollection getElementsByName([MarshalAs(UnmanagedType.BStr)] string v);
[DispId(1088)]
IHTMLElement getElementById([MarshalAs(UnmanagedType.BStr)] string v);
[DispId(1087)]
IHTMLElementCollection getElementsByTagName([MarshalAs(UnmanagedType.BStr)] string v);
}
}

View file

@ -0,0 +1,35 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
[ComVisible(true), Guid("3050f69a-98b5-11cf-bb82-00aa00bdce0b"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
TypeLibType(TypeLibTypeFlags.FDual)]
public interface IHTMLDocument4 {
[DispId(1090)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool hasFocus();
}
}

View file

@ -0,0 +1,36 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
[ComImport, ComVisible(true), Guid("3050f80c-98b5-11cf-bb82-00aa00bdce0b"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
TypeLibType(TypeLibTypeFlags.FDual)]
public interface IHTMLDocument5 {
[DispId(1102)]
string compatMode {
[return: MarshalAs(UnmanagedType.BStr)] get;
}
}
}

View file

@ -0,0 +1,113 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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.Collections;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
namespace Greenshot.Helpers.IEInterop {
[ComImport, Guid("3050F1FF-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLElement {
[DispId(-2147417611)]
void setAttribute([MarshalAs(UnmanagedType.BStr)] string strAttributeName, object AttributeValue, int lFlags);
[DispId(-2147417610)]
object getAttribute([MarshalAs(UnmanagedType.BStr)] string strAttributeName, int lFlags);
long offsetLeft {
[DispId(-2147417104)]
get;
}
long offsetTop {
[DispId(-2147417103)]
get;
}
long offsetWidth {
[DispId(-2147417102)]
get;
}
long offsetHeight {
[DispId(-2147417101)]
get;
}
IHTMLElement offsetParent {
[DispId(-2147417100)]
get;
}
string className {
[DispId(-2147417111)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
IHTMLDocument2 document {
[DispId(-2147417094)]
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
string id {
[DispId(-2147417110)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
string innerHTML {
[DispId(-2147417086)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
string innerText {
[DispId(-2147417085)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
IHTMLStyle style {
[DispId(-2147418038)]
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
string tagName {
[DispId(-2147417108)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
string title {
[DispId(-2147418043)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
[DispId(-2147417093)]
void scrollIntoView(bool varargStart);
}
}

View file

@ -0,0 +1,35 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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.Collections;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
namespace Greenshot.Helpers.IEInterop {
[ComImport, Guid("3050F434-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLElement2 {
[DispId(-2147417067)]
[return: MarshalAs(UnmanagedType.IDispatch)]
IHTMLRect getBoundingClientRect();
}
}

View file

@ -0,0 +1,34 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
[ComImport(), ComVisible(true),
Guid("3050F21F-98B5-11CF-BB82-00AA00BDCE0B"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
TypeLibType(TypeLibTypeFlags.FDispatchable)]
public interface IHTMLElementCollection : IEnumerable {
new IEnumerator GetEnumerator();
}
}

View file

@ -0,0 +1,104 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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 Greenshot.Helpers.IEInterop {
[ComVisible(true), ComImport(), Guid("3050f311-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLFrameBase {
//dispinterface IHTMLFrameBase {
// properties:
// methods:
// [id(0x80010bb8), propput]
// void src([in] BSTR rhs);
// [id(0x80010bb8), propget]
// BSTR src();
// [id(0x80010000), propput]
// void name([in] BSTR rhs);
// [id(0x80010000), propget]
// BSTR name();
// [id(0x80010bba), propput]
// void border([in] VARIANT rhs);
// [id(0x80010bba), propget]
// VARIANT border();
// [id(0x80010bbb), propput]
// void frameBorder([in] BSTR rhs);
// [id(0x80010bbb), propget]
// BSTR frameBorder();
// [id(0x80010bbc), propput]
// void frameSpacing([in] VARIANT rhs);
// [id(0x80010bbc), propget]
// VARIANT frameSpacing();
// [id(0x80010bbd), propput]
// void marginWidth([in] VARIANT rhs);
// [id(0x80010bbd), propget]
// VARIANT marginWidth();
// [id(0x80010bbe), propput]
// void marginHeight([in] VARIANT rhs);
// [id(0x80010bbe), propget]
// VARIANT marginHeight();
// [id(0x80010bbf), propput]
// void noResize([in] VARIANT_BOOL rhs);
// [id(0x80010bbf), propget]
// VARIANT_BOOL noResize();
// [id(0x80010bc0), propput]
// void scrolling([in] BSTR rhs);
// [id(0x80010bc0), propget]
// BSTR scrolling();
//};
// [DispId(HTMLDispIDs.DISPID_IHTMLFRAMEBASE_SRC)]
string src {
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
string name {
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
object border {
get;
}
string frameBorder {
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
object frameSpacing {
get;
}
object marginWidth {
get;
}
object marginHeight {
get;
}
bool noResize {
[return: MarshalAs(UnmanagedType.VariantBool)]
get;
}
string scrolling {
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
}
}

View file

@ -0,0 +1,41 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
[ComImport(), ComVisible(true),
Guid("332C4426-26CB-11D0-B483-00C04FD90119"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
TypeLibType(TypeLibTypeFlags.FDispatchable)]
public interface IHTMLFramesCollection2 {
[DispId(0)]
[return: MarshalAs(UnmanagedType.IDispatch)]
IHTMLWindow2 item(int pvarIndex);
long length {
[DispId(1001)]
get;
}
}
}

View file

@ -0,0 +1,50 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
namespace Greenshot.Helpers.IEInterop {
[ComImport, Guid("3050F4A3-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLRect {
int bottom {
[DispId(1004)]
get;
}
int left {
[DispId(1001)]
get;
}
int right {
[DispId(1003)]
get;
}
int top {
[DispId(1002)]
get;
}
}
}

View file

@ -0,0 +1,40 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
[ComImport, Guid("3050F35C-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLScreen {
[DispId(1003)]
int width {
get;
}
[DispId(1004)]
int height {
get;
}
}
}

View file

@ -0,0 +1,51 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
[ComImport, Guid("3050F84A-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLScreen2 {
int logicalXDPI {
[DispId(1009)]
get;
}
int logicalYDPI {
[DispId(1010)]
get;
}
int deviceXDPI {
[DispId(1011)]
get;
}
int deviceYDPI {
[DispId(1012)]
get;
}
};
}

View file

@ -0,0 +1,41 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
namespace Greenshot.Helpers.IEInterop {
// See: http://msdn.microsoft.com/en-us/library/aa768849%28v=vs.85%29.aspx
[ComImport, Guid("3050f25A-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLSelectionObject {
[return: MarshalAs(UnmanagedType.IDispatch)]
[DispId(1001)]
IHTMLTxtRange createRange();
[DispId(1002)]
void empty();
[DispId(1003)]
void clear();
[DispId(1004)]
string EventType { [return: MarshalAs(UnmanagedType.BStr)] get;}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,139 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
namespace Greenshot.Helpers.IEInterop {
// See: http://msdn.microsoft.com/en-us/library/aa741548%28v=vs.85%29.aspx
[ComImport, Guid("3050F220-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLTxtRange {
[DispId(1006)]
IHTMLElement parentElement();
[DispId(1008)]
IHTMLTxtRange duplicate();
[DispId(1010)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool inRange(IHTMLTxtRange range);
[DispId(1011)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool isEqual(IHTMLTxtRange range);
[DispId(1012)]
void scrollIntoView([MarshalAs(UnmanagedType.VariantBool)] bool fStart);
[DispId(1013)]
void collapse([MarshalAs(UnmanagedType.VariantBool)] bool Start);
[DispId(1014)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool expand([MarshalAs(UnmanagedType.BStr)] string Unit);
[DispId(1015)]
int move([MarshalAs(UnmanagedType.BStr)] string Unit, int Count);
[DispId(1016)]
int moveStart([MarshalAs(UnmanagedType.BStr)] string Unit, int Count);
[DispId(1017)]
int moveEnd([MarshalAs(UnmanagedType.BStr)] string Unit, int Count);
[DispId(1024)]
void select();
[DispId(1026)]
void pasteHTML([MarshalAs(UnmanagedType.BStr)] string html);
[DispId(1001)]
void moveToElementText(IHTMLElement element);
[DispId(1025)]
void setEndPoint([MarshalAs(UnmanagedType.BStr)] string how, IHTMLTxtRange SourceRange);
[DispId(1018)]
int compareEndPoints([MarshalAs(UnmanagedType.BStr)] string how, IHTMLTxtRange SourceRange);
[DispId(1019)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool findText([MarshalAs(UnmanagedType.BStr)] string String, int Count, int Flags);
[DispId(1020)]
void moveToPoint(int x, int y);
[DispId(1021)]
[return: MarshalAs(UnmanagedType.BStr)]
string getBookmark();
[DispId(1009)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool moveToBookmark([MarshalAs(UnmanagedType.BStr)] string Bookmark);
[DispId(1027)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool queryCommandSupported([MarshalAs(UnmanagedType.BStr)] string cmdID);
[DispId(1028)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool queryCommandEnabled([MarshalAs(UnmanagedType.BStr)] string cmdID);
[DispId(1029)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool queryCommandState([MarshalAs(UnmanagedType.BStr)] string cmdID);
[DispId(1030)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool queryCommandIndeterm([MarshalAs(UnmanagedType.BStr)] string cmdID);
[DispId(1031)]
[return: MarshalAs(UnmanagedType.BStr)]
string queryCommandText([MarshalAs(UnmanagedType.BStr)] string cmdID);
[DispId(1032)]
object queryCommandValue([MarshalAs(UnmanagedType.BStr)] string cmdID);
[DispId(1033)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool execCommand([MarshalAs(UnmanagedType.BStr)] string cmdID, [MarshalAs(UnmanagedType.VariantBool)] bool showUI, object value);
[DispId(1034)]
[return: MarshalAs(UnmanagedType.VariantBool)]
bool execCommandShowHelp([MarshalAs(UnmanagedType.BStr)] string cmdID);
string htmlText {
[DispId(1003)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
}
string text {
[DispId(1004)]
[return: MarshalAs(UnmanagedType.BStr)]
get;
[DispId(1004)]
set;
}
}
}

View file

@ -0,0 +1,48 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
[ComVisible(true), ComImport(), Guid("332c4427-26cb-11d0-b483-00c04fd90119"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLWindow2 {
[DispId(1156)]
IHTMLScreen screen {
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
[DispId(1151)]
IHTMLDocument2 document {
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
[DispId(11)]
string name {
[return: MarshalAs(UnmanagedType.BStr)] get;
}
}
}

View file

@ -0,0 +1,36 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
namespace Greenshot.Helpers.IEInterop {
[ComVisible(true), ComImport(), Guid("3050f4ae-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLWindow3 {
[DispId(1170)]
int screenLeft { get;}
[DispId(1171)]
int screenTop { get;}
}
}

View file

@ -0,0 +1,35 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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 Greenshot.Helpers.IEInterop {
[ComVisible(true), ComImport(), Guid("3050f6cf-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLWindow4 {
[DispId(1181)]
IHTMLFrameBase frameElement {
[return: MarshalAs(UnmanagedType.IDispatch)]
get;
}
}
}

View file

@ -0,0 +1,34 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
// Needed to get the Window handle from the IDocument2
// See: http://msdn.microsoft.com/en-us/library/ms680102%28v=vs.85%29.aspx
[ComImport, Guid("00000114-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleWindow {
void GetWindow(out IntPtr phwnd);
void ContextSensitiveHelp([In, MarshalAs(UnmanagedType.Bool)] bool fEnterMode);
}
}

View file

@ -0,0 +1,33 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
namespace Greenshot.Helpers.IEInterop {
// This is the COM IServiceProvider interface, not System.IServiceProvider .Net interface!
[ComImport(), ComVisible(true), Guid("6D5140C1-7436-11CE-8034-00AA006009FA"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IServiceProvider {
[return: MarshalAs(UnmanagedType.I4)][PreserveSig]
int QueryService(ref Guid guidService, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObject);
}
}

View file

@ -0,0 +1,156 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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;
using System.Runtime.InteropServices.ComTypes;
using System.Collections;
namespace Greenshot.Helpers.IEInterop {
// IWebBrowser: EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B
// [ComVisible(true), ComImport(), Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E"),
// TypeLibType(TypeLibTypeFlags.FDual),
// InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
// public interface IWebBrowser2 {
// [DispId(203)]
// object Document {
// [return: MarshalAs(UnmanagedType.IDispatch)]
// get;
// }
// }
[ComImport, /*SuppressUnmanagedCodeSecurity,*/
TypeLibType(TypeLibTypeFlags.FOleAutomation |
TypeLibTypeFlags.FDual |
TypeLibTypeFlags.FHidden),
Guid("D30C1661-CDAF-11d0-8A3E-00C04FC9E26E")]
public interface IWebBrowser2 {
[DispId(100)]
void GoBack();
[DispId(0x65)]
void GoForward();
[DispId(0x66)]
void GoHome();
[DispId(0x67)]
void GoSearch();
[DispId(0x68)]
void Navigate([In] string Url,
[In] ref object flags,
[In] ref object targetFrameName,
[In] ref object postData,
[In] ref object headers);
[DispId(-550)]
void Refresh();
[DispId(0x69)]
void Refresh2([In] ref object level);
[DispId(0x6a)]
void Stop();
[DispId(200)]
object Application {
[return:
MarshalAs(UnmanagedType.IDispatch)]
get;
}
[DispId(0xc9)]
object Parent {
[return:
MarshalAs(UnmanagedType.IDispatch)]
get;
}
[DispId(0xca)]
object Container {
[return:
MarshalAs(UnmanagedType.IDispatch)]
get;
}
[DispId(0xcb)]
object Document {
[return:
MarshalAs(UnmanagedType.IDispatch)]
get;
}
[DispId(0xcc)]
bool TopLevelContainer { get; }
[DispId(0xcd)]
string Type { get; }
[DispId(0xce)]
int Left { get; set; }
[DispId(0xcf)]
int Top { get; set; }
[DispId(0xd0)]
int Width { get; set; }
[DispId(0xd1)]
int Height { get; set; }
[DispId(210)]
string LocationName { get; }
[DispId(0xd3)]
string LocationURL { get; }
[DispId(0xd4)]
bool Busy { get; }
[DispId(300)]
void Quit();
[DispId(0x12d)]
void ClientToWindow(out int pcx, out int pcy);
[DispId(0x12e)]
void PutProperty([In] string property, [In] object vtValue);
[DispId(0x12f)]
object GetProperty([In] string property);
[DispId(0)]
string Name { get; }
[DispId(-515)]
int HWND { get; }
[DispId(400)]
string FullName { get; }
[DispId(0x191)]
string Path { get; }
[DispId(0x192)]
bool Visible { get; set; }
[DispId(0x193)]
bool StatusBar { get; set; }
[DispId(0x194)]
string StatusText { get; set; }
[DispId(0x195)]
int ToolBar { get; set; }
[DispId(0x196)]
bool MenuBar { get; set; }
[DispId(0x197)]
bool FullScreen { get; set; }
[DispId(500)]
void Navigate2([In] ref object URL,
[In] ref object flags,
[In] ref object targetFrameName,
[In] ref object postData,
[In] ref object headers);
[DispId(550)]
bool Offline { get; set; }
[DispId(0x227)]
bool Silent { get; set; }
[DispId(0x228)]
bool RegisterAsBrowser { get; set; }
[DispId(0x229)]
bool RegisterAsDropTarget { get; set; }
[DispId(0x22a)]
bool TheaterMode { get; set; }
[DispId(0x22b)]
bool AddressBar { get; set; }
[DispId(0x22c)]
bool Resizable { get; set; }
}
}