diff --git a/GreenshotInterop/GreenshotInterop.csproj b/GreenshotInterop/GreenshotInterop.csproj
new file mode 100644
index 000000000..d29125004
--- /dev/null
+++ b/GreenshotInterop/GreenshotInterop.csproj
@@ -0,0 +1,91 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {ADD4E400-56E1-4E31-A5C2-070BEB238A0F}
+ Library
+ Properties
+ GreenshotInterop
+ GreenshotInterop
+ v2.0
+ 512
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\Greenshot\Lib\log4net.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GreenshotInterop/GreenshotInterop.csproj.user b/GreenshotInterop/GreenshotInterop.csproj.user
new file mode 100644
index 000000000..695b5c78b
--- /dev/null
+++ b/GreenshotInterop/GreenshotInterop.csproj.user
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLBodyElement.cs b/GreenshotInterop/IEInterop/IHTMLBodyElement.cs
new file mode 100644
index 000000000..652e9ab69
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLBodyElement.cs
@@ -0,0 +1,35 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [ComImport, Guid("3050F1D8-98B5-11CF-BB82-00AA00BDCE0B"),
+ TypeLibType(TypeLibTypeFlags.FDual),
+ InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ public interface IHTMLBodyElement {
+ string scroll {
+ set;
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+ }
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLCurrentStyle.cs b/GreenshotInterop/IEInterop/IHTMLCurrentStyle.cs
new file mode 100644
index 000000000..5fdfe1e53
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLCurrentStyle.cs
@@ -0,0 +1,67 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [ComImport, Guid("3050f3db-98b5-11cf-bb82-00aa00bdce0b"),
+ TypeLibType(TypeLibTypeFlags.FDual),
+ InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ public interface IHTMLCurrentStyle {
+ /// styleFloat property of IHTMLStyle interface.
+ string styleFloat {
+ [DispId(-2147413042)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ string left {
+ [DispId(-2147418112 + 3)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+ string top {
+ [DispId(-2147418112 + 4)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+ string width {
+ [DispId(-2147418112 + 5)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+ string height {
+ [DispId(-2147418112 + 6)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+ string right {
+ [DispId(-2147418112 + 0x4d)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+ string bottom {
+ [DispId(-2147418112 + 0x4e)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+ }
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLDocument.cs b/GreenshotInterop/IEInterop/IHTMLDocument.cs
new file mode 100644
index 000000000..ce7d04c0e
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLDocument.cs
@@ -0,0 +1,36 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ /// IHTMLDocument interface.
+ [Guid("626FC520-A41E-11CF-A731-00A0C9082637")]
+ [ComImport]
+ [TypeLibType(TypeLibTypeFlags.FDual)]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ public interface IHTMLDocument {
+ object Script {
+ [return: MarshalAs(UnmanagedType.IDispatch)]
+ get;
+ }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLDocument2.cs b/GreenshotInterop/IEInterop/IHTMLDocument2.cs
new file mode 100644
index 000000000..8820b896f
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLDocument2.cs
@@ -0,0 +1,77 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ /// IHTMLDocument2 interface.
+ [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;
+ }
+
+ string designMode {
+ [DispId(1014)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ [DispId(1014)]
+ set;
+ }
+ }
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLDocument3.cs b/GreenshotInterop/IEInterop/IHTMLDocument3.cs
new file mode 100644
index 000000000..fb64f34e0
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLDocument3.cs
@@ -0,0 +1,47 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ /// IHTMLDocument3 interface.
+ [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);
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLDocument4.cs b/GreenshotInterop/IEInterop/IHTMLDocument4.cs
new file mode 100644
index 000000000..2faeb7c63
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLDocument4.cs
@@ -0,0 +1,33 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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();
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLDocument5.cs b/GreenshotInterop/IEInterop/IHTMLDocument5.cs
new file mode 100644
index 000000000..d7e2bc480
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLDocument5.cs
@@ -0,0 +1,34 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLElement.cs b/GreenshotInterop/IEInterop/IHTMLElement.cs
new file mode 100644
index 000000000..0aeaf324b
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLElement.cs
@@ -0,0 +1,117 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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);
+
+ IHTMLElementCollection children {
+ [DispId(-2147417075)]
+ [return: MarshalAs(UnmanagedType.IDispatch)]
+ get;
+ }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLElement2.cs b/GreenshotInterop/IEInterop/IHTMLElement2.cs
new file mode 100644
index 000000000..7e98b714f
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLElement2.cs
@@ -0,0 +1,39 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [ComImport, Guid("3050F434-98B5-11CF-BB82-00AA00BDCE0B"),
+ TypeLibType(TypeLibTypeFlags.FDual),
+ InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ public interface IHTMLElement2 {
+ [DispId(-2147417067)]
+ [return: MarshalAs(UnmanagedType.IDispatch)]
+ IHTMLRect getBoundingClientRect();
+
+ IHTMLCurrentStyle currentStyle {
+ [DispId(-2147417105)]
+ [return: MarshalAs(UnmanagedType.Interface)] //IHTMLCurrentStyle
+ get;
+ }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLElementCollection.cs b/GreenshotInterop/IEInterop/IHTMLElementCollection.cs
new file mode 100644
index 000000000..d57ffbdc1
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLElementCollection.cs
@@ -0,0 +1,33 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [ComImport(), ComVisible(true),
+ Guid("3050F21F-98B5-11CF-BB82-00AA00BDCE0B"),
+ InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
+ TypeLibType(TypeLibTypeFlags.FDispatchable)]
+ public interface IHTMLElementCollection : IEnumerable {
+ new IEnumerator GetEnumerator();
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLFrameBase.cs b/GreenshotInterop/IEInterop/IHTMLFrameBase.cs
new file mode 100644
index 000000000..ea63f70d6
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLFrameBase.cs
@@ -0,0 +1,104 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;
+ }
+ }
+
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLFramesCollection2.cs b/GreenshotInterop/IEInterop/IHTMLFramesCollection2.cs
new file mode 100644
index 000000000..7397b4bdd
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLFramesCollection2.cs
@@ -0,0 +1,39 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLRect.cs b/GreenshotInterop/IEInterop/IHTMLRect.cs
new file mode 100644
index 000000000..70d877cd8
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLRect.cs
@@ -0,0 +1,49 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;
+ }
+ }
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLScreen.cs b/GreenshotInterop/IEInterop/IHTMLScreen.cs
new file mode 100644
index 000000000..6913b3f34
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLScreen.cs
@@ -0,0 +1,38 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;
+ }
+ }
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLScreen2.cs b/GreenshotInterop/IEInterop/IHTMLScreen2.cs
new file mode 100644
index 000000000..c4020fa9e
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLScreen2.cs
@@ -0,0 +1,49 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;
+ }
+ };
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLSelectionObject.cs b/GreenshotInterop/IEInterop/IHTMLSelectionObject.cs
new file mode 100644
index 000000000..80ee435af
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLSelectionObject.cs
@@ -0,0 +1,40 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ // 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;}
+ }
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLStyle.cs b/GreenshotInterop/IEInterop/IHTMLStyle.cs
new file mode 100644
index 000000000..6eb9fbc40
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLStyle.cs
@@ -0,0 +1,1188 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [ComImport, Guid("3050F25E-98B5-11CF-BB82-00AA00BDCE0B"),
+ TypeLibType(TypeLibTypeFlags.FDual),
+ InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ public interface IHTMLStyle {
+ /// setAttribute method of IHTMLStyle interface.
+ /// An original IDL definition of setAttribute method was the following: HRESULT setAttribute (BSTR strAttributeName, VARIANT AttributeValue, [optional, defaultvalue(1)] long lFlags);
+ // IDL: HRESULT setAttribute (BSTR strAttributeName, VARIANT AttributeValue, [optional, defaultvalue(1)] long lFlags);
+ // VB6: Sub setAttribute (ByVal strAttributeName As String, ByVal AttributeValue As Any, [ByVal lFlags As Long = 1])
+ [DispId(-2147417611)]
+ void setAttribute([MarshalAs(UnmanagedType.BStr)] string strAttributeName, object AttributeValue, int lFlags);
+
+ /// getAttribute method of IHTMLStyle interface.
+ /// An original IDL definition of getAttribute method was the following: HRESULT getAttribute (BSTR strAttributeName, [optional, defaultvalue(0)] long lFlags, [out, retval] VARIANT* ReturnValue);
+ // IDL: HRESULT getAttribute (BSTR strAttributeName, [optional, defaultvalue(0)] long lFlags, [out, retval] VARIANT* ReturnValue);
+ // VB6: Function getAttribute (ByVal strAttributeName As String, [ByVal lFlags As Long = 0]) As Any
+ [DispId(-2147417610)]
+ object getAttribute([MarshalAs(UnmanagedType.BStr)] string strAttributeName, int lFlags);
+
+ /// removeAttribute method of IHTMLStyle interface.
+ /// An original IDL definition of removeAttribute method was the following: HRESULT removeAttribute (BSTR strAttributeName, [optional, defaultvalue(1)] long lFlags, [out, retval] VARIANT_BOOL* ReturnValue);
+ // IDL: HRESULT removeAttribute (BSTR strAttributeName, [optional, defaultvalue(1)] long lFlags, [out, retval] VARIANT_BOOL* ReturnValue);
+ // VB6: Function removeAttribute (ByVal strAttributeName As String, [ByVal lFlags As Long = 1]) As Boolean
+ [DispId(-2147417609)]
+ [return: MarshalAs(UnmanagedType.VariantBool)]
+ bool removeAttribute([MarshalAs(UnmanagedType.BStr)] string strAttributeName, int lFlags);
+
+ /// toString method of IHTMLStyle interface.
+ /// An original IDL definition of toString method was the following: HRESULT toString ([out, retval] BSTR* ReturnValue);
+ // IDL: HRESULT toString ([out, retval] BSTR* ReturnValue);
+ // VB6: Function toString As String
+ [DispId(-2147414104)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ string toString();
+
+ /// background property of IHTMLStyle interface.
+ /// An original IDL definition of background property was the following: BSTR background;
+ // IDL: BSTR background;
+ // VB6: background As String
+ string background {
+ // IDL: HRESULT background ([out, retval] BSTR* ReturnValue);
+ // VB6: Function background As String
+ [DispId(-2147413080)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT background (BSTR value);
+ // VB6: Sub background (ByVal value As String)
+ [DispId(-2147413080)]
+ set;
+ }
+
+ /// backgroundAttachment property of IHTMLStyle interface.
+ /// An original IDL definition of backgroundAttachment property was the following: BSTR backgroundAttachment;
+ // IDL: BSTR backgroundAttachment;
+ // VB6: backgroundAttachment As String
+ string backgroundAttachment {
+ // IDL: HRESULT backgroundAttachment ([out, retval] BSTR* ReturnValue);
+ // VB6: Function backgroundAttachment As String
+ [DispId(-2147413067)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT backgroundAttachment (BSTR value);
+ // VB6: Sub backgroundAttachment (ByVal value As String)
+ [DispId(-2147413067)]
+ set;
+ }
+
+ /// backgroundColor property of IHTMLStyle interface.
+ /// An original IDL definition of backgroundColor property was the following: VARIANT backgroundColor;
+ // IDL: VARIANT backgroundColor;
+ // VB6: backgroundColor As Any
+ object backgroundColor {
+ // IDL: HRESULT backgroundColor ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function backgroundColor As Any
+ [DispId(-501)]
+ get;
+ // IDL: HRESULT backgroundColor (VARIANT value);
+ // VB6: Sub backgroundColor (ByVal value As Any)
+ [DispId(-501)]
+ set;
+ }
+
+ /// backgroundImage property of IHTMLStyle interface.
+ /// An original IDL definition of backgroundImage property was the following: BSTR backgroundImage;
+ // IDL: BSTR backgroundImage;
+ // VB6: backgroundImage As String
+ string backgroundImage {
+ // IDL: HRESULT backgroundImage ([out, retval] BSTR* ReturnValue);
+ // VB6: Function backgroundImage As String
+ [DispId(-2147413111)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT backgroundImage (BSTR value);
+ // VB6: Sub backgroundImage (ByVal value As String)
+ [DispId(-2147413111)]
+ set;
+ }
+
+ /// backgroundPosition property of IHTMLStyle interface.
+ /// An original IDL definition of backgroundPosition property was the following: BSTR backgroundPosition;
+ // IDL: BSTR backgroundPosition;
+ // VB6: backgroundPosition As String
+ string backgroundPosition {
+ // IDL: HRESULT backgroundPosition ([out, retval] BSTR* ReturnValue);
+ // VB6: Function backgroundPosition As String
+ [DispId(-2147413066)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT backgroundPosition (BSTR value);
+ // VB6: Sub backgroundPosition (ByVal value As String)
+ [DispId(-2147413066)]
+ set;
+ }
+
+ /// backgroundPositionX property of IHTMLStyle interface.
+ /// An original IDL definition of backgroundPositionX property was the following: VARIANT backgroundPositionX;
+ // IDL: VARIANT backgroundPositionX;
+ // VB6: backgroundPositionX As Any
+ object backgroundPositionX {
+ // IDL: HRESULT backgroundPositionX ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function backgroundPositionX As Any
+ [DispId(-2147413079)]
+ get;
+ // IDL: HRESULT backgroundPositionX (VARIANT value);
+ // VB6: Sub backgroundPositionX (ByVal value As Any)
+ [DispId(-2147413079)]
+ set;
+ }
+
+ /// backgroundPositionY property of IHTMLStyle interface.
+ /// An original IDL definition of backgroundPositionY property was the following: VARIANT backgroundPositionY;
+ // IDL: VARIANT backgroundPositionY;
+ // VB6: backgroundPositionY As Any
+ object backgroundPositionY {
+ // IDL: HRESULT backgroundPositionY ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function backgroundPositionY As Any
+ [DispId(-2147413078)]
+ get;
+ // IDL: HRESULT backgroundPositionY (VARIANT value);
+ // VB6: Sub backgroundPositionY (ByVal value As Any)
+ [DispId(-2147413078)]
+ set;
+ }
+
+ /// backgroundRepeat property of IHTMLStyle interface.
+ /// An original IDL definition of backgroundRepeat property was the following: BSTR backgroundRepeat;
+ // IDL: BSTR backgroundRepeat;
+ // VB6: backgroundRepeat As String
+ string backgroundRepeat {
+ // IDL: HRESULT backgroundRepeat ([out, retval] BSTR* ReturnValue);
+ // VB6: Function backgroundRepeat As String
+ [DispId(-2147413068)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT backgroundRepeat (BSTR value);
+ // VB6: Sub backgroundRepeat (ByVal value As String)
+ [DispId(-2147413068)]
+ set;
+ }
+
+ /// border property of IHTMLStyle interface.
+ /// An original IDL definition of border property was the following: BSTR border;
+ // IDL: BSTR border;
+ // VB6: border As String
+ string border {
+ // IDL: HRESULT border ([out, retval] BSTR* ReturnValue);
+ // VB6: Function border As String
+ [DispId(-2147413063)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT border (BSTR value);
+ // VB6: Sub border (ByVal value As String)
+ [DispId(-2147413063)]
+ set;
+ }
+
+ /// borderBottom property of IHTMLStyle interface.
+ /// An original IDL definition of borderBottom property was the following: BSTR borderBottom;
+ // IDL: BSTR borderBottom;
+ // VB6: borderBottom As String
+ string borderBottom {
+ // IDL: HRESULT borderBottom ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderBottom As String
+ [DispId(-2147413060)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderBottom (BSTR value);
+ // VB6: Sub borderBottom (ByVal value As String)
+ [DispId(-2147413060)]
+ set;
+ }
+
+ /// borderBottomColor property of IHTMLStyle interface.
+ /// An original IDL definition of borderBottomColor property was the following: VARIANT borderBottomColor;
+ // IDL: VARIANT borderBottomColor;
+ // VB6: borderBottomColor As Any
+ object borderBottomColor {
+ // IDL: HRESULT borderBottomColor ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function borderBottomColor As Any
+ [DispId(-2147413055)]
+ get;
+ // IDL: HRESULT borderBottomColor (VARIANT value);
+ // VB6: Sub borderBottomColor (ByVal value As Any)
+ [DispId(-2147413055)]
+ set;
+ }
+
+ /// borderBottomStyle property of IHTMLStyle interface.
+ /// An original IDL definition of borderBottomStyle property was the following: BSTR borderBottomStyle;
+ // IDL: BSTR borderBottomStyle;
+ // VB6: borderBottomStyle As String
+ string borderBottomStyle {
+ // IDL: HRESULT borderBottomStyle ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderBottomStyle As String
+ [DispId(-2147413045)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderBottomStyle (BSTR value);
+ // VB6: Sub borderBottomStyle (ByVal value As String)
+ [DispId(-2147413045)]
+ set;
+ }
+
+ /// borderBottomWidth property of IHTMLStyle interface.
+ /// An original IDL definition of borderBottomWidth property was the following: VARIANT borderBottomWidth;
+ // IDL: VARIANT borderBottomWidth;
+ // VB6: borderBottomWidth As Any
+ object borderBottomWidth {
+ // IDL: HRESULT borderBottomWidth ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function borderBottomWidth As Any
+ [DispId(-2147413050)]
+ get;
+ // IDL: HRESULT borderBottomWidth (VARIANT value);
+ // VB6: Sub borderBottomWidth (ByVal value As Any)
+ [DispId(-2147413050)]
+ set;
+ }
+
+ /// borderColor property of IHTMLStyle interface.
+ /// An original IDL definition of borderColor property was the following: BSTR borderColor;
+ // IDL: BSTR borderColor;
+ // VB6: borderColor As String
+ string borderColor {
+ // IDL: HRESULT borderColor ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderColor As String
+ [DispId(-2147413058)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderColor (BSTR value);
+ // VB6: Sub borderColor (ByVal value As String)
+ [DispId(-2147413058)]
+ set;
+ }
+
+ /// borderLeft property of IHTMLStyle interface.
+ /// An original IDL definition of borderLeft property was the following: BSTR borderLeft;
+ // IDL: BSTR borderLeft;
+ // VB6: borderLeft As String
+ string borderLeft {
+ // IDL: HRESULT borderLeft ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderLeft As String
+ [DispId(-2147413059)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderLeft (BSTR value);
+ // VB6: Sub borderLeft (ByVal value As String)
+ [DispId(-2147413059)]
+ set;
+ }
+
+ /// borderLeftColor property of IHTMLStyle interface.
+ /// An original IDL definition of borderLeftColor property was the following: VARIANT borderLeftColor;
+ // IDL: VARIANT borderLeftColor;
+ // VB6: borderLeftColor As Any
+ object borderLeftColor {
+ // IDL: HRESULT borderLeftColor ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function borderLeftColor As Any
+ [DispId(-2147413054)]
+ get;
+ // IDL: HRESULT borderLeftColor (VARIANT value);
+ // VB6: Sub borderLeftColor (ByVal value As Any)
+ [DispId(-2147413054)]
+ set;
+ }
+
+ /// borderLeftStyle property of IHTMLStyle interface.
+ /// An original IDL definition of borderLeftStyle property was the following: BSTR borderLeftStyle;
+ // IDL: BSTR borderLeftStyle;
+ // VB6: borderLeftStyle As String
+ string borderLeftStyle {
+ // IDL: HRESULT borderLeftStyle ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderLeftStyle As String
+ [DispId(-2147413044)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderLeftStyle (BSTR value);
+ // VB6: Sub borderLeftStyle (ByVal value As String)
+ [DispId(-2147413044)]
+ set;
+ }
+
+ /// borderLeftWidth property of IHTMLStyle interface.
+ /// An original IDL definition of borderLeftWidth property was the following: VARIANT borderLeftWidth;
+ // IDL: VARIANT borderLeftWidth;
+ // VB6: borderLeftWidth As Any
+ object borderLeftWidth {
+ // IDL: HRESULT borderLeftWidth ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function borderLeftWidth As Any
+ [DispId(-2147413049)]
+ get;
+ // IDL: HRESULT borderLeftWidth (VARIANT value);
+ // VB6: Sub borderLeftWidth (ByVal value As Any)
+ [DispId(-2147413049)]
+ set;
+ }
+
+ /// borderRight property of IHTMLStyle interface.
+ /// An original IDL definition of borderRight property was the following: BSTR borderRight;
+ // IDL: BSTR borderRight;
+ // VB6: borderRight As String
+ string borderRight {
+ // IDL: HRESULT borderRight ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderRight As String
+ [DispId(-2147413061)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderRight (BSTR value);
+ // VB6: Sub borderRight (ByVal value As String)
+ [DispId(-2147413061)]
+ set;
+ }
+
+ /// borderRightColor property of IHTMLStyle interface.
+ /// An original IDL definition of borderRightColor property was the following: VARIANT borderRightColor;
+ // IDL: VARIANT borderRightColor;
+ // VB6: borderRightColor As Any
+ object borderRightColor {
+ // IDL: HRESULT borderRightColor ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function borderRightColor As Any
+ [DispId(-2147413056)]
+ get;
+ // IDL: HRESULT borderRightColor (VARIANT value);
+ // VB6: Sub borderRightColor (ByVal value As Any)
+ [DispId(-2147413056)]
+ set;
+ }
+
+ /// borderRightStyle property of IHTMLStyle interface.
+ /// An original IDL definition of borderRightStyle property was the following: BSTR borderRightStyle;
+ // IDL: BSTR borderRightStyle;
+ // VB6: borderRightStyle As String
+ string borderRightStyle {
+ // IDL: HRESULT borderRightStyle ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderRightStyle As String
+ [DispId(-2147413046)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderRightStyle (BSTR value);
+ // VB6: Sub borderRightStyle (ByVal value As String)
+ [DispId(-2147413046)]
+ set;
+ }
+
+ /// borderRightWidth property of IHTMLStyle interface.
+ /// An original IDL definition of borderRightWidth property was the following: VARIANT borderRightWidth;
+ // IDL: VARIANT borderRightWidth;
+ // VB6: borderRightWidth As Any
+ object borderRightWidth {
+ // IDL: HRESULT borderRightWidth ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function borderRightWidth As Any
+ [DispId(-2147413051)]
+ get;
+ // IDL: HRESULT borderRightWidth (VARIANT value);
+ // VB6: Sub borderRightWidth (ByVal value As Any)
+ [DispId(-2147413051)]
+ set;
+ }
+
+ /// borderStyle property of IHTMLStyle interface.
+ /// An original IDL definition of borderStyle property was the following: BSTR borderStyle;
+ // IDL: BSTR borderStyle;
+ // VB6: borderStyle As String
+ string borderStyle {
+ // IDL: HRESULT borderStyle ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderStyle As String
+ [DispId(-2147413048)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderStyle (BSTR value);
+ // VB6: Sub borderStyle (ByVal value As String)
+ [DispId(-2147413048)]
+ set;
+ }
+
+ /// borderTop property of IHTMLStyle interface.
+ /// An original IDL definition of borderTop property was the following: BSTR borderTop;
+ // IDL: BSTR borderTop;
+ // VB6: borderTop As String
+ string borderTop {
+ // IDL: HRESULT borderTop ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderTop As String
+ [DispId(-2147413062)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderTop (BSTR value);
+ // VB6: Sub borderTop (ByVal value As String)
+ [DispId(-2147413062)]
+ set;
+ }
+
+ /// borderTopColor property of IHTMLStyle interface.
+ /// An original IDL definition of borderTopColor property was the following: VARIANT borderTopColor;
+ // IDL: VARIANT borderTopColor;
+ // VB6: borderTopColor As Any
+ object borderTopColor {
+ // IDL: HRESULT borderTopColor ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function borderTopColor As Any
+ [DispId(-2147413057)]
+ get;
+ // IDL: HRESULT borderTopColor (VARIANT value);
+ // VB6: Sub borderTopColor (ByVal value As Any)
+ [DispId(-2147413057)]
+ set;
+ }
+
+ /// borderTopStyle property of IHTMLStyle interface.
+ /// An original IDL definition of borderTopStyle property was the following: BSTR borderTopStyle;
+ // IDL: BSTR borderTopStyle;
+ // VB6: borderTopStyle As String
+ string borderTopStyle {
+ // IDL: HRESULT borderTopStyle ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderTopStyle As String
+ [DispId(-2147413047)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderTopStyle (BSTR value);
+ // VB6: Sub borderTopStyle (ByVal value As String)
+ [DispId(-2147413047)]
+ set;
+ }
+
+ /// borderTopWidth property of IHTMLStyle interface.
+ /// An original IDL definition of borderTopWidth property was the following: VARIANT borderTopWidth;
+ // IDL: VARIANT borderTopWidth;
+ // VB6: borderTopWidth As Any
+ object borderTopWidth {
+ // IDL: HRESULT borderTopWidth ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function borderTopWidth As Any
+ [DispId(-2147413052)]
+ get;
+ // IDL: HRESULT borderTopWidth (VARIANT value);
+ // VB6: Sub borderTopWidth (ByVal value As Any)
+ [DispId(-2147413052)]
+ set;
+ }
+
+ /// borderWidth property of IHTMLStyle interface.
+ /// An original IDL definition of borderWidth property was the following: BSTR borderWidth;
+ // IDL: BSTR borderWidth;
+ // VB6: borderWidth As String
+ string borderWidth {
+ // IDL: HRESULT borderWidth ([out, retval] BSTR* ReturnValue);
+ // VB6: Function borderWidth As String
+ [DispId(-2147413053)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT borderWidth (BSTR value);
+ // VB6: Sub borderWidth (ByVal value As String)
+ [DispId(-2147413053)]
+ set;
+ }
+
+ /// clear property of IHTMLStyle interface.
+ /// An original IDL definition of clear property was the following: BSTR clear;
+ // IDL: BSTR clear;
+ // VB6: clear As String
+ string clear
+ {
+ // IDL: HRESULT clear ([out, retval] BSTR* ReturnValue);
+ // VB6: Function clear As String
+ [DispId(-2147413096)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT clear (BSTR value);
+ // VB6: Sub clear (ByVal value As String)
+ [DispId(-2147413096)]
+ set;
+ }
+
+ /// clip property of IHTMLStyle interface.
+ /// An original IDL definition of clip property was the following: BSTR clip;
+ // IDL: BSTR clip;
+ // VB6: clip As String
+ string clip
+ {
+ // IDL: HRESULT clip ([out, retval] BSTR* ReturnValue);
+ // VB6: Function clip As String
+ [DispId(-2147413020)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT clip (BSTR value);
+ // VB6: Sub clip (ByVal value As String)
+ [DispId(-2147413020)]
+ set;
+ }
+
+ /// color property of IHTMLStyle interface.
+ /// An original IDL definition of color property was the following: VARIANT color;
+ // IDL: VARIANT color;
+ // VB6: color As Any
+ object color
+ {
+ // IDL: HRESULT color ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function color As Any
+ [DispId(-2147413110)]
+ get;
+ // IDL: HRESULT color (VARIANT value);
+ // VB6: Sub color (ByVal value As Any)
+ [DispId(-2147413110)]
+ set;
+ }
+
+ /// cssText property of IHTMLStyle interface.
+ /// An original IDL definition of cssText property was the following: BSTR cssText;
+ // IDL: BSTR cssText;
+ // VB6: cssText As String
+ string cssText
+ {
+ // IDL: HRESULT cssText ([out, retval] BSTR* ReturnValue);
+ // VB6: Function cssText As String
+ [DispId(-2147413013)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT cssText (BSTR value);
+ // VB6: Sub cssText (ByVal value As String)
+ [DispId(-2147413013)]
+ set;
+ }
+
+ /// cursor property of IHTMLStyle interface.
+ /// An original IDL definition of cursor property was the following: BSTR cursor;
+ // IDL: BSTR cursor;
+ // VB6: cursor As String
+ string cursor
+ {
+ // IDL: HRESULT cursor ([out, retval] BSTR* ReturnValue);
+ // VB6: Function cursor As String
+ [DispId(-2147413010)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT cursor (BSTR value);
+ // VB6: Sub cursor (ByVal value As String)
+ [DispId(-2147413010)]
+ set;
+ }
+
+ /// display property of IHTMLStyle interface.
+ /// An original IDL definition of display property was the following: BSTR display;
+ // IDL: BSTR display;
+ // VB6: display As String
+ string display
+ {
+ // IDL: HRESULT display ([out, retval] BSTR* ReturnValue);
+ // VB6: Function display As String
+ [DispId(-2147413041)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT display (BSTR value);
+ // VB6: Sub display (ByVal value As String)
+ [DispId(-2147413041)]
+ set;
+ }
+
+ /// filter property of IHTMLStyle interface.
+ /// An original IDL definition of filter property was the following: BSTR filter;
+ // IDL: BSTR filter;
+ // VB6: filter As String
+ string filter
+ {
+ // IDL: HRESULT filter ([out, retval] BSTR* ReturnValue);
+ // VB6: Function filter As String
+ [DispId(-2147413030)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT filter (BSTR value);
+ // VB6: Sub filter (ByVal value As String)
+ [DispId(-2147413030)]
+ set;
+ }
+
+ /// font property of IHTMLStyle interface.
+ /// An original IDL definition of font property was the following: BSTR font;
+ // IDL: BSTR font;
+ // VB6: font As String
+ string font
+ {
+ // IDL: HRESULT font ([out, retval] BSTR* ReturnValue);
+ // VB6: Function font As String
+ [DispId(-2147413071)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT font (BSTR value);
+ // VB6: Sub font (ByVal value As String)
+ [DispId(-2147413071)]
+ set;
+ }
+
+ /// fontFamily property of IHTMLStyle interface.
+ /// An original IDL definition of fontFamily property was the following: BSTR fontFamily;
+ // IDL: BSTR fontFamily;
+ // VB6: fontFamily As String
+ string fontFamily
+ {
+ // IDL: HRESULT fontFamily ([out, retval] BSTR* ReturnValue);
+ // VB6: Function fontFamily As String
+ [DispId(-2147413094)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT fontFamily (BSTR value);
+ // VB6: Sub fontFamily (ByVal value As String)
+ [DispId(-2147413094)]
+ set;
+ }
+
+ /// fontSize property of IHTMLStyle interface.
+ /// An original IDL definition of fontSize property was the following: VARIANT fontSize;
+ // IDL: VARIANT fontSize;
+ // VB6: fontSize As Any
+ object fontSize
+ {
+ // IDL: HRESULT fontSize ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function fontSize As Any
+ [DispId(-2147413093)]
+ get;
+ // IDL: HRESULT fontSize (VARIANT value);
+ // VB6: Sub fontSize (ByVal value As Any)
+ [DispId(-2147413093)]
+ set;
+ }
+
+ /// fontStyle property of IHTMLStyle interface.
+ /// An original IDL definition of fontStyle property was the following: BSTR fontStyle;
+ // IDL: BSTR fontStyle;
+ // VB6: fontStyle As String
+ string fontStyle
+ {
+ // IDL: HRESULT fontStyle ([out, retval] BSTR* ReturnValue);
+ // VB6: Function fontStyle As String
+ [DispId(-2147413088)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT fontStyle (BSTR value);
+ // VB6: Sub fontStyle (ByVal value As String)
+ [DispId(-2147413088)]
+ set;
+ }
+
+ /// fontVariant property of IHTMLStyle interface.
+ /// An original IDL definition of fontVariant property was the following: BSTR fontVariant;
+ // IDL: BSTR fontVariant;
+ // VB6: fontVariant As String
+ string fontVariant
+ {
+ // IDL: HRESULT fontVariant ([out, retval] BSTR* ReturnValue);
+ // VB6: Function fontVariant As String
+ [DispId(-2147413087)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT fontVariant (BSTR value);
+ // VB6: Sub fontVariant (ByVal value As String)
+ [DispId(-2147413087)]
+ set;
+ }
+
+ /// fontWeight property of IHTMLStyle interface.
+ /// An original IDL definition of fontWeight property was the following: BSTR fontWeight;
+ // IDL: BSTR fontWeight;
+ // VB6: fontWeight As String
+ string fontWeight
+ {
+ // IDL: HRESULT fontWeight ([out, retval] BSTR* ReturnValue);
+ // VB6: Function fontWeight As String
+ [DispId(-2147413085)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT fontWeight (BSTR value);
+ // VB6: Sub fontWeight (ByVal value As String)
+ [DispId(-2147413085)]
+ set;
+ }
+
+ /// height property of IHTMLStyle interface.
+ /// An original IDL definition of height property was the following: VARIANT height;
+ // IDL: VARIANT height;
+ // VB6: height As Any
+ object height
+ {
+ // IDL: HRESULT height ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function height As Any
+ [DispId(-2147418106)]
+ get;
+ // IDL: HRESULT height (VARIANT value);
+ // VB6: Sub height (ByVal value As Any)
+ [DispId(-2147418106)]
+ set;
+ }
+
+ /// left property of IHTMLStyle interface.
+ /// An original IDL definition of left property was the following: VARIANT left;
+ // IDL: VARIANT left;
+ // VB6: left As Any
+ object left
+ {
+ // IDL: HRESULT left ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function left As Any
+ [DispId(-2147418109)]
+ get;
+ // IDL: HRESULT left (VARIANT value);
+ // VB6: Sub left (ByVal value As Any)
+ [DispId(-2147418109)]
+ set;
+ }
+
+ /// letterSpacing property of IHTMLStyle interface.
+ /// An original IDL definition of letterSpacing property was the following: VARIANT letterSpacing;
+ // IDL: VARIANT letterSpacing;
+ // VB6: letterSpacing As Any
+ object letterSpacing
+ {
+ // IDL: HRESULT letterSpacing ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function letterSpacing As Any
+ [DispId(-2147413104)]
+ get;
+ // IDL: HRESULT letterSpacing (VARIANT value);
+ // VB6: Sub letterSpacing (ByVal value As Any)
+ [DispId(-2147413104)]
+ set;
+ }
+
+ /// lineHeight property of IHTMLStyle interface.
+ /// An original IDL definition of lineHeight property was the following: VARIANT lineHeight;
+ // IDL: VARIANT lineHeight;
+ // VB6: lineHeight As Any
+ object lineHeight
+ {
+ // IDL: HRESULT lineHeight ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function lineHeight As Any
+ [DispId(-2147413106)]
+ get;
+ // IDL: HRESULT lineHeight (VARIANT value);
+ // VB6: Sub lineHeight (ByVal value As Any)
+ [DispId(-2147413106)]
+ set;
+ }
+
+ /// listStyle property of IHTMLStyle interface.
+ /// An original IDL definition of listStyle property was the following: BSTR listStyle;
+ // IDL: BSTR listStyle;
+ // VB6: listStyle As String
+ string listStyle
+ {
+ // IDL: HRESULT listStyle ([out, retval] BSTR* ReturnValue);
+ // VB6: Function listStyle As String
+ [DispId(-2147413037)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT listStyle (BSTR value);
+ // VB6: Sub listStyle (ByVal value As String)
+ [DispId(-2147413037)]
+ set;
+ }
+
+ /// listStyleImage property of IHTMLStyle interface.
+ /// An original IDL definition of listStyleImage property was the following: BSTR listStyleImage;
+ // IDL: BSTR listStyleImage;
+ // VB6: listStyleImage As String
+ string listStyleImage
+ {
+ // IDL: HRESULT listStyleImage ([out, retval] BSTR* ReturnValue);
+ // VB6: Function listStyleImage As String
+ [DispId(-2147413038)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT listStyleImage (BSTR value);
+ // VB6: Sub listStyleImage (ByVal value As String)
+ [DispId(-2147413038)]
+ set;
+ }
+
+ /// listStylePosition property of IHTMLStyle interface.
+ /// An original IDL definition of listStylePosition property was the following: BSTR listStylePosition;
+ // IDL: BSTR listStylePosition;
+ // VB6: listStylePosition As String
+ string listStylePosition
+ {
+ // IDL: HRESULT listStylePosition ([out, retval] BSTR* ReturnValue);
+ // VB6: Function listStylePosition As String
+ [DispId(-2147413039)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT listStylePosition (BSTR value);
+ // VB6: Sub listStylePosition (ByVal value As String)
+ [DispId(-2147413039)]
+ set;
+ }
+
+ /// listStyleType property of IHTMLStyle interface.
+ /// An original IDL definition of listStyleType property was the following: BSTR listStyleType;
+ // IDL: BSTR listStyleType;
+ // VB6: listStyleType As String
+ string listStyleType
+ {
+ // IDL: HRESULT listStyleType ([out, retval] BSTR* ReturnValue);
+ // VB6: Function listStyleType As String
+ [DispId(-2147413040)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT listStyleType (BSTR value);
+ // VB6: Sub listStyleType (ByVal value As String)
+ [DispId(-2147413040)]
+ set;
+ }
+
+ /// margin property of IHTMLStyle interface.
+ /// An original IDL definition of margin property was the following: BSTR margin;
+ // IDL: BSTR margin;
+ // VB6: margin As String
+ string margin
+ {
+ // IDL: HRESULT margin ([out, retval] BSTR* ReturnValue);
+ // VB6: Function margin As String
+ [DispId(-2147413076)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT margin (BSTR value);
+ // VB6: Sub margin (ByVal value As String)
+ [DispId(-2147413076)]
+ set;
+ }
+
+ /// marginBottom property of IHTMLStyle interface.
+ /// An original IDL definition of marginBottom property was the following: VARIANT marginBottom;
+ // IDL: VARIANT marginBottom;
+ // VB6: marginBottom As Any
+ object marginBottom
+ {
+ // IDL: HRESULT marginBottom ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function marginBottom As Any
+ [DispId(-2147413073)]
+ get;
+ // IDL: HRESULT marginBottom (VARIANT value);
+ // VB6: Sub marginBottom (ByVal value As Any)
+ [DispId(-2147413073)]
+ set;
+ }
+
+ /// marginLeft property of IHTMLStyle interface.
+ /// An original IDL definition of marginLeft property was the following: VARIANT marginLeft;
+ // IDL: VARIANT marginLeft;
+ // VB6: marginLeft As Any
+ object marginLeft
+ {
+ // IDL: HRESULT marginLeft ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function marginLeft As Any
+ [DispId(-2147413072)]
+ get;
+ // IDL: HRESULT marginLeft (VARIANT value);
+ // VB6: Sub marginLeft (ByVal value As Any)
+ [DispId(-2147413072)]
+ set;
+ }
+
+ /// marginRight property of IHTMLStyle interface.
+ /// An original IDL definition of marginRight property was the following: VARIANT marginRight;
+ // IDL: VARIANT marginRight;
+ // VB6: marginRight As Any
+ object marginRight
+ {
+ // IDL: HRESULT marginRight ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function marginRight As Any
+ [DispId(-2147413074)]
+ get;
+ // IDL: HRESULT marginRight (VARIANT value);
+ // VB6: Sub marginRight (ByVal value As Any)
+ [DispId(-2147413074)]
+ set;
+ }
+
+ /// marginTop property of IHTMLStyle interface.
+ /// An original IDL definition of marginTop property was the following: VARIANT marginTop;
+ // IDL: VARIANT marginTop;
+ // VB6: marginTop As Any
+ object marginTop
+ {
+ // IDL: HRESULT marginTop ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function marginTop As Any
+ [DispId(-2147413075)]
+ get;
+ // IDL: HRESULT marginTop (VARIANT value);
+ // VB6: Sub marginTop (ByVal value As Any)
+ [DispId(-2147413075)]
+ set;
+ }
+
+ /// overflow property of IHTMLStyle interface.
+ /// An original IDL definition of overflow property was the following: BSTR overflow;
+ // IDL: BSTR overflow;
+ // VB6: overflow As String
+ string overflow
+ {
+ // IDL: HRESULT overflow ([out, retval] BSTR* ReturnValue);
+ // VB6: Function overflow As String
+ [DispId(-2147413102)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT overflow (BSTR value);
+ // VB6: Sub overflow (ByVal value As String)
+ [DispId(-2147413102)]
+ set;
+ }
+
+ /// padding property of IHTMLStyle interface.
+ /// An original IDL definition of padding property was the following: BSTR padding;
+ // IDL: BSTR padding;
+ // VB6: padding As String
+ string padding
+ {
+ // IDL: HRESULT padding ([out, retval] BSTR* ReturnValue);
+ // VB6: Function padding As String
+ [DispId(-2147413101)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ // IDL: HRESULT padding (BSTR value);
+ // VB6: Sub padding (ByVal value As String)
+ [DispId(-2147413101)]
+ set;
+ }
+
+ /// paddingBottom property of IHTMLStyle interface.
+ /// An original IDL definition of paddingBottom property was the following: VARIANT paddingBottom;
+ // IDL: VARIANT paddingBottom;
+ // VB6: paddingBottom As Any
+ object paddingBottom
+ {
+ // IDL: HRESULT paddingBottom ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function paddingBottom As Any
+ [DispId(-2147413098)]
+ get;
+ // IDL: HRESULT paddingBottom (VARIANT value);
+ // VB6: Sub paddingBottom (ByVal value As Any)
+ [DispId(-2147413098)]
+ set;
+ }
+
+ /// paddingLeft property of IHTMLStyle interface.
+ /// An original IDL definition of paddingLeft property was the following: VARIANT paddingLeft;
+ // IDL: VARIANT paddingLeft;
+ // VB6: paddingLeft As Any
+ object paddingLeft
+ {
+ // IDL: HRESULT paddingLeft ([out, retval] VARIANT* ReturnValue);
+ // VB6: Function paddingLeft As Any
+ [DispId(-2147413097)]
+ get;
+ // IDL: HRESULT paddingLeft (VARIANT value);
+ // VB6: Sub paddingLeft (ByVal value As Any)
+ [DispId(-2147413097)]
+ set;
+ }
+
+ /// paddingRight property of IHTMLStyle interface.
+ object paddingRight {
+ [DispId(-2147413099)]
+ get;
+ }
+
+ /// paddingTop property of IHTMLStyle interface.
+ object paddingTop {
+ [DispId(-2147413100)]
+ get;
+ }
+
+ /// pageBreakAfter property of IHTMLStyle interface.
+ string pageBreakAfter {
+ [DispId(-2147413034)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// pageBreakBefore property of IHTMLStyle interface.
+ string pageBreakBefore {
+ [DispId(-2147413035)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// pixelHeight property of IHTMLStyle interface.
+ int pixelHeight {
+ [DispId(-2147414109)]
+ get;
+ }
+
+ /// pixelLeft property of IHTMLStyle interface.
+ int pixelLeft {
+ [DispId(-2147414111)]
+ get;
+ }
+
+ /// pixelTop property of IHTMLStyle interface.
+ int pixelTop {
+ [DispId(-2147414112)]
+ get;
+ }
+
+ /// pixelWidth property of IHTMLStyle interface.
+ int pixelWidth {
+ [DispId(-2147414110)]
+ get;
+ }
+
+ /// posHeight property of IHTMLStyle interface.
+ float posHeight {
+ [DispId(-2147414105)]
+ get;
+ }
+
+ /// position property of IHTMLStyle interface.
+ string position {
+ [DispId(-2147413022)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// posLeft property of IHTMLStyle interface.
+ float posLeft {
+ [DispId(-2147414107)]
+ get;
+ }
+
+ /// posTop property of IHTMLStyle interface.
+ float posTop {
+ [DispId(-2147414108)]
+ get;
+ }
+
+ /// posWidth property of IHTMLStyle interface.
+ float posWidth {
+ [DispId(-2147414106)]
+ get;
+ }
+
+ /// styleFloat property of IHTMLStyle interface.
+ string styleFloat {
+ [DispId(-2147413042)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// textAlign property of IHTMLStyle interface.
+ string textAlign {
+ [DispId(-2147418040)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// textDecoration property of IHTMLStyle interface.
+ string textDecoration {
+ [DispId(-2147413077)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// textDecorationBlink property of IHTMLStyle interface.
+ bool textDecorationBlink {
+ [DispId(-2147413090)]
+ [return: MarshalAs(UnmanagedType.VariantBool)]
+ get;
+ }
+
+ /// textDecorationLineThrough property of IHTMLStyle interface.
+ bool textDecorationLineThrough {
+ [DispId(-2147413092)]
+ [return: MarshalAs(UnmanagedType.VariantBool)]
+ get;
+ }
+
+ /// textDecorationNone property of IHTMLStyle interface.
+ bool textDecorationNone {
+ [DispId(-2147413089)]
+ [return: MarshalAs(UnmanagedType.VariantBool)]
+ get;
+ }
+
+ /// textDecorationOverline property of IHTMLStyle interface.
+ bool textDecorationOverline {
+ [DispId(-2147413043)]
+ [return: MarshalAs(UnmanagedType.VariantBool)]
+ get;
+ }
+
+ /// textDecorationUnderline property of IHTMLStyle interface.
+ bool textDecorationUnderline {
+ [DispId(-2147413091)]
+ [return: MarshalAs(UnmanagedType.VariantBool)]
+ get;
+ }
+
+ /// textIndent property of IHTMLStyle interface.
+ object textIndent {
+ [DispId(-2147413105)]
+ get;
+ }
+
+ /// textTransform property of IHTMLStyle interface.
+ string textTransform {
+ [DispId(-2147413108)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// top property of IHTMLStyle interface.
+ object top {
+ [DispId(-2147418108)]
+ get;
+ }
+
+ /// verticalAlign property of IHTMLStyle interface.
+ object verticalAlign {
+ [DispId(-2147413064)]
+ get;
+ }
+
+ /// visibility property of IHTMLStyle interface.
+ string visibility {
+ [DispId(-2147413032)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// whiteSpace property of IHTMLStyle interface.
+ string whiteSpace {
+ [DispId(-2147413036)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
+
+ /// width property of IHTMLStyle interface.
+ object width {
+ [DispId(-2147418107)]
+ get;
+ }
+
+ /// wordSpacing property of IHTMLStyle interface.
+ object wordSpacing {
+ [DispId(-2147413065)]
+ get;
+ }
+
+ /// zIndex property of IHTMLStyle interface.
+ object zIndex {
+ [DispId(-2147413021)]
+ get;
+ }
+ }
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLTxtRange.cs b/GreenshotInterop/IEInterop/IHTMLTxtRange.cs
new file mode 100644
index 000000000..88ec30c2e
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLTxtRange.cs
@@ -0,0 +1,138 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ // 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;
+ }
+ }
+}
diff --git a/GreenshotInterop/IEInterop/IHTMLWindow2.cs b/GreenshotInterop/IEInterop/IHTMLWindow2.cs
new file mode 100644
index 000000000..2230960fa
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLWindow2.cs
@@ -0,0 +1,46 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLWindow3.cs b/GreenshotInterop/IEInterop/IHTMLWindow3.cs
new file mode 100644
index 000000000..0a15a0888
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLWindow3.cs
@@ -0,0 +1,35 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;}
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IHTMLWindow4.cs b/GreenshotInterop/IEInterop/IHTMLWindow4.cs
new file mode 100644
index 000000000..4a2ac10ed
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IHTMLWindow4.cs
@@ -0,0 +1,35 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ [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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/IEInterop/IWebBrowser2.cs b/GreenshotInterop/IEInterop/IWebBrowser2.cs
new file mode 100644
index 000000000..606cf9b98
--- /dev/null
+++ b/GreenshotInterop/IEInterop/IWebBrowser2.cs
@@ -0,0 +1,154 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.IE {
+ // 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; }
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/Interop/COMWrapper.cs b/GreenshotInterop/Interop/COMWrapper.cs
new file mode 100644
index 000000000..1b9b83c49
--- /dev/null
+++ b/GreenshotInterop/Interop/COMWrapper.cs
@@ -0,0 +1,501 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+
+namespace Greenshot.Interop {
+ ///
+ /// Wraps a late-bound COM server.
+ ///
+ public sealed class COMWrapper : RealProxy, IDisposable {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(COMWrapper));
+ private const int MK_E_UNAVAILABLE = -2147221021;
+ #region Private Data
+
+ ///
+ /// Holds reference to the actual COM object which is wrapped by this proxy
+ ///
+ private object _COMObject;
+
+ ///
+ /// Type of the COM object, set on constructor after getting the COM reference
+ ///
+ private Type _COMType;
+
+ ///
+ /// The type of which method calls are intercepted and executed on the COM object.
+ ///
+ private Type _InterceptType;
+
+ #endregion
+
+ #region Construction
+
+ ///
+ /// Gets a COM object and returns the transparent proxy which intercepts all calls to the object
+ ///
+ /// Interface which defines the method and properties to intercept
+ /// Transparent proxy to the real proxy for the object
+ /// The must be an interface decorated with the attribute.
+ public static T GetInstance() {
+ Type type = typeof(T);
+ if (null == type) {
+ throw new ArgumentNullException("type");
+ }
+ if (!type.IsInterface) {
+ throw new ArgumentException("The specified type must be an interface.", "type");
+ }
+
+ ComProgIdAttribute progID = ComProgIdAttribute.GetAttribute(type);
+ if (null == progID || null == progID.Value || 0 == progID.Value.Length) {
+ throw new ArgumentException("The specified type must define a ComProgId attribute.", "type");
+ }
+
+ object comObject = null;
+ Type comType = Type.GetTypeFromProgID(progID.Value, true);
+ try {
+ comObject = Marshal.GetActiveObject(progID.Value);
+ } catch (COMException comE) {
+ if (comE.ErrorCode == MK_E_UNAVAILABLE) {
+ LOG.DebugFormat("No current instance of {0} object available.", progID.Value);
+ } else {
+ LOG.Warn("Error getting active object for " + progID.Value, comE);
+ }
+ } catch (Exception e) {
+ LOG.Warn("Error getting active object for " + progID.Value, e);
+ }
+
+ if (comObject != null) {
+ COMWrapper wrapper = new COMWrapper(comObject, type);
+ return (T)wrapper.GetTransparentProxy();
+ }
+ return default(T);
+ }
+
+ ///
+ /// Gets or creates a COM object and returns the transparent proxy
+ /// which intercepts all calls to the object
+ ///
+ /// Interface which defines the method and properties to intercept
+ /// Transparent proxy to the real proxy for the object
+ /// The must be an interface decorated with the attribute.
+ public static T GetOrCreateInstance() {
+ Type type = typeof(T);
+ if (null == type) {
+ throw new ArgumentNullException("type");
+ }
+ if (!type.IsInterface) {
+ throw new ArgumentException("The specified type must be an interface.", "type");
+ }
+
+ ComProgIdAttribute progID = ComProgIdAttribute.GetAttribute(type);
+ if (null == progID || null == progID.Value || 0 == progID.Value.Length) {
+ throw new ArgumentException("The specified type must define a ComProgId attribute.", "type");
+ }
+
+ object comObject = null;
+ Type comType = Type.GetTypeFromProgID(progID.Value, true);
+ try {
+ comObject = Marshal.GetActiveObject(progID.Value);
+ } catch (COMException comE) {
+ if (comE.ErrorCode == MK_E_UNAVAILABLE) {
+ LOG.DebugFormat("No current instance of {0} object available.", progID.Value);
+ } else {
+ LOG.Warn("Error getting active object for " + progID.Value, comE);
+ }
+ } catch (Exception e) {
+ LOG.Warn("Error getting active object for " + progID.Value, e);
+ }
+ // Did we get the current instance? If not, try to create a new
+ if (comObject == null) {
+ try {
+ comObject = Activator.CreateInstance(comType);
+ if (comObject != null) {
+ LOG.DebugFormat("Created new instance of {0} object.", progID.Value);
+ }
+ } catch (Exception e) {
+ LOG.Warn("Error creating object for " + progID.Value, e);
+ }
+ }
+ if (comObject != null) {
+ COMWrapper wrapper = new COMWrapper(comObject, type);
+ return (T)wrapper.GetTransparentProxy();
+ }
+ throw new TypeLoadException(string.Format("Unable to get or create an instance of the specified COM server \"{0}\".", progID.Value));
+ }
+
+ ///
+ /// Wrap an object and return the transparent proxy which intercepts all calls to the object
+ ///
+ /// An object to intercept
+ /// Interface which defines the method and properties to intercept
+ /// Transparent proxy to the real proxy for the object
+ private static object Wrap(object comObject, Type type) {
+ if (null == comObject) {
+ throw new ArgumentNullException("comObject");
+ }
+ if (null == type) {
+ throw new ArgumentNullException("type");
+ }
+
+ COMWrapper wrapper = new COMWrapper(comObject, type);
+ return wrapper.GetTransparentProxy();
+ }
+
+ ///
+ /// Constructor
+ ///
+ ///
+ /// The COM object to wrap.
+ ///
+ ///
+ /// The interface type to impersonate.
+ ///
+ private COMWrapper(object comObject, Type type) : base(type) {
+ this._COMObject = comObject;
+ this._COMType = comObject.GetType();
+ this._InterceptType = type;
+ }
+
+ #endregion
+
+ #region Clean up
+
+ ///
+ /// If is not called, we need to make
+ /// sure that the COM object is still cleaned up.
+ ///
+ ~COMWrapper() {
+ LOG.DebugFormat("Finalize {0}", this._InterceptType.ToString());
+ this.Dispose(false);
+ }
+
+ ///
+ /// Cleans up the COM object.
+ ///
+ public void Dispose() {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ ///
+ /// Release the COM reference
+ ///
+ ///
+ /// if this was called from the
+ /// interface.
+ ///
+ private void Dispose(bool disposing) {
+ if (null != this._COMObject) {
+ if (Marshal.IsComObject(this._COMObject)) {
+ try {
+ while (Marshal.ReleaseComObject(this._COMObject) > 0) ;
+ } catch (Exception ex) {
+ LOG.WarnFormat("Problem releasing {0}", _COMType);
+ LOG.Warn("Error: ", ex);
+ }
+ }
+
+ this._COMObject = null;
+ }
+ }
+
+ #endregion
+
+ #region Object methods
+
+ ///
+ /// Returns a string representing the wrapped object.
+ ///
+ ///
+ /// The full name of the intercepted type.
+ ///
+ public override string ToString() {
+ return this._InterceptType.FullName;
+ }
+
+ ///
+ /// Returns the hash code of the wrapped object.
+ ///
+ ///
+ /// The hash code of the wrapped object.
+ ///
+ public override int GetHashCode() {
+ return this._COMObject.GetHashCode();
+ }
+
+ ///
+ /// Compares this object to another.
+ ///
+ ///
+ /// The value to compare to.
+ ///
+ ///
+ /// if the objects are equal.
+ ///
+ public override bool Equals(object value) {
+ if (null != value && RemotingServices.IsTransparentProxy(value)) {
+ COMWrapper wrapper = RemotingServices.GetRealProxy(value) as COMWrapper;
+ if (null != wrapper) {
+ return this._COMObject == wrapper._COMObject;
+ }
+ }
+
+ return base.Equals(value);
+ }
+
+ ///
+ /// Returns the base type for a reference type.
+ ///
+ ///
+ /// The reference type.
+ ///
+ ///
+ /// The base value type.
+ ///
+ ///
+ /// is .
+ ///
+ private static Type GetByValType(Type byRefType) {
+ if (null == byRefType) {
+ throw new ArgumentNullException("byRefType");
+ }
+
+ if (byRefType.IsByRef) {
+ string name = byRefType.FullName;
+ name = name.Substring(0, name.Length - 1);
+ byRefType = byRefType.Assembly.GetType(name, true);
+ }
+
+ return byRefType;
+ }
+
+ #endregion
+
+ public static T Cast(object wrapperProxy) {
+ if (wrapperProxy == null) {
+ return default(T);
+ }
+ Type newType = typeof(T);
+ COMWrapper oldWrapper = RemotingServices.GetRealProxy(wrapperProxy) as COMWrapper;
+ COMWrapper newWrapper = new COMWrapper(oldWrapper._COMObject, newType);
+ return (T)newWrapper.GetTransparentProxy();
+ }
+
+ ///
+ /// Intercept method calls
+ ///
+ ///
+ /// Contains information about the method being called
+ ///
+ ///
+ /// A .
+ ///
+ public override IMessage Invoke(IMessage myMessage) {
+ IMethodCallMessage callMessage = myMessage as IMethodCallMessage;
+ if (null == callMessage) {
+ LOG.DebugFormat("Message type not implemented: {0}", myMessage.GetType().ToString());
+ return null;
+ }
+
+ MethodInfo method = callMessage.MethodBase as MethodInfo;
+ if (null == method) {
+ LOG.DebugFormat("Unrecognized Invoke call: {0}", callMessage.MethodBase.ToString());
+ return null;
+ }
+
+ object returnValue = null;
+ object[] outArgs = null;
+ int outArgsCount = 0;
+
+ string methodName = method.Name;
+ Type returnType = method.ReturnType;
+ BindingFlags flags = BindingFlags.InvokeMethod;
+ int argCount = callMessage.ArgCount;
+
+ object invokeObject;
+ Type invokeType;
+ Type byValType;
+
+ object[] args;
+ object arg;
+ COMWrapper[] originalArgs;
+ COMWrapper wrapper;
+
+ ParameterModifier[] argModifiers = null;
+ ParameterInfo[] parameters = null;
+ ParameterInfo parameter;
+
+ if ("Dispose" == methodName && 0 == argCount && typeof(void) == returnType) {
+ this.Dispose();
+ } else if ("ToString" == methodName && 0 == argCount && typeof(string) == returnType) {
+ returnValue = this.ToString();
+ } else if ("GetType" == methodName && 0 == argCount && typeof(System.Type) == returnType) {
+ returnValue = this._InterceptType;
+ } else if ("GetHashCode" == methodName && 0 == argCount && typeof(int) == returnType) {
+ returnValue = this.GetHashCode();
+ } else if ("Equals" == methodName && 1 == argCount && typeof(bool) == returnType) {
+ returnValue = this.Equals(callMessage.Args[0]);
+ } else if (1 == argCount && typeof(void) == returnType && (methodName.StartsWith("add_") || methodName.StartsWith("remove_"))) {
+ bool removeHandler = methodName.StartsWith("remove_");
+ methodName = methodName.Substring(removeHandler ? 7 : 4);
+
+ Delegate handler = callMessage.InArgs[0] as Delegate;
+ if (null == handler) {
+ return new ReturnMessage(new ArgumentNullException("handler"), callMessage);
+ }
+ } else {
+ invokeObject = this._COMObject;
+ invokeType = this._COMType;
+
+ if (methodName.StartsWith("get_")) {
+ // Property Get
+ methodName = methodName.Substring(4);
+ flags = BindingFlags.GetProperty;
+ args = callMessage.InArgs;
+ } else if (methodName.StartsWith("set_")) {
+ // Property Set
+ methodName = methodName.Substring(4);
+ flags = BindingFlags.SetProperty;
+ args = callMessage.InArgs;
+ } else {
+ args = callMessage.Args;
+ if (null != args && 0 != args.Length) {
+ // Modifiers for ref / out parameters
+ argModifiers = new ParameterModifier[1];
+ argModifiers[0] = new ParameterModifier(args.Length);
+
+ parameters = method.GetParameters();
+ for (int i = 0; i < parameters.Length; i++) {
+ parameter = parameters[i];
+ if (parameter.IsOut || parameter.ParameterType.IsByRef) {
+ argModifiers[0][i] = true;
+ outArgsCount++;
+ }
+ }
+
+ if (0 == outArgsCount) {
+ argModifiers = null;
+ }
+ }
+ }
+
+ // Un-wrap wrapped COM objects before passing to the method
+ if (null == args || 0 == args.Length) {
+ originalArgs = null;
+ } else {
+ originalArgs = new COMWrapper[args.Length];
+ for (int i = 0; i < args.Length; i++) {
+ if (null != args[i] && RemotingServices.IsTransparentProxy(args[i])) {
+ wrapper = RemotingServices.GetRealProxy(args[i]) as COMWrapper;
+ if (null != wrapper) {
+ originalArgs[i] = wrapper;
+ args[i] = wrapper._COMObject;
+ }
+ } else if (0 != outArgsCount && argModifiers[0][i]) {
+ byValType = GetByValType(parameters[i].ParameterType);
+ if (byValType.IsInterface) {
+ // If we're passing a COM object by reference, and
+ // the parameter is null, we need to pass a
+ // DispatchWrapper to avoid a type mismatch exception.
+ if (null == args[i]) {
+ args[i] = new DispatchWrapper(null);
+ }
+ } else if (typeof(Decimal) == byValType) {
+ // If we're passing a decimal value by reference,
+ // we need to pass a CurrencyWrapper to avoid a
+ // type mismatch exception.
+ // http://support.microsoft.com/?kbid=837378
+ args[i] = new CurrencyWrapper(args[i]);
+ }
+ }
+ }
+ }
+
+ try {
+ returnValue = invokeType.InvokeMember(methodName, flags, null, invokeObject, args, argModifiers, null, null);
+ } catch (Exception ex) {
+ return new ReturnMessage(ex, callMessage);
+ }
+
+ // Handle enum and interface return types
+ if (null != returnValue) {
+ if (returnType.IsInterface) {
+ // Wrap the returned value in an intercepting COM wrapper
+ if (Marshal.IsComObject(returnValue)) {
+ returnValue = COMWrapper.Wrap(returnValue, returnType);
+ }
+ } else if (returnType.IsEnum) {
+ // Convert to proper Enum type
+ returnValue = Enum.Parse(returnType, returnValue.ToString());
+ }
+ }
+
+ // Handle out args
+ if (0 != outArgsCount) {
+ outArgs = new object[args.Length];
+ for (int i = 0; i < parameters.Length; i++) {
+ if (!argModifiers[0][i]) {
+ continue;
+ }
+
+ arg = args[i];
+ if (null == arg) {
+ continue;
+ }
+
+ parameter = parameters[i];
+ wrapper = null;
+
+ byValType = GetByValType(parameter.ParameterType);
+ if (typeof(Decimal) == byValType) {
+ if (arg is CurrencyWrapper) {
+ arg = ((CurrencyWrapper)arg).WrappedObject;
+ }
+ } else if (byValType.IsEnum) {
+ arg = Enum.Parse(byValType, arg.ToString());
+ } else if (byValType.IsInterface) {
+ if (Marshal.IsComObject(arg)) {
+ wrapper = originalArgs[i];
+ if (null != wrapper && wrapper._COMObject != arg) {
+ wrapper.Dispose();
+ wrapper = null;
+ }
+
+ if (null == wrapper) {
+ wrapper = new COMWrapper(arg, byValType);
+ }
+ arg = wrapper.GetTransparentProxy();
+ }
+ }
+ outArgs[i] = arg;
+ }
+ }
+ }
+
+ return new ReturnMessage(returnValue, outArgs, outArgsCount, callMessage.LogicalCallContext, callMessage);
+ }
+ }
+}
diff --git a/GreenshotInterop/Interop/ComProgIdAttribute.cs b/GreenshotInterop/Interop/ComProgIdAttribute.cs
new file mode 100644
index 000000000..0b34ed4fb
--- /dev/null
+++ b/GreenshotInterop/Interop/ComProgIdAttribute.cs
@@ -0,0 +1,81 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+
+namespace Greenshot.Interop {
+ ///
+ /// An attribute to specifiy the ProgID of the COM class to create. (As suggested by Kristen Wegner)
+ ///
+ [AttributeUsage(AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
+ public sealed class ComProgIdAttribute : Attribute {
+ private string _value;
+
+ ///
+ /// Extracts the attribute from the specified type.
+ ///
+ ///
+ /// The interface type.
+ ///
+ ///
+ /// The .
+ ///
+ ///
+ /// is .
+ ///
+ public static ComProgIdAttribute GetAttribute(Type interfaceType) {
+ if (null == interfaceType) {
+ throw new ArgumentNullException("interfaceType");
+ }
+
+ Type attributeType = typeof(ComProgIdAttribute);
+ object[] attributes = interfaceType.GetCustomAttributes(attributeType, false);
+
+ if (null == attributes || 0 == attributes.Length) {
+ Type[] interfaces = interfaceType.GetInterfaces();
+ for (int i = 0; i < interfaces.Length; i++) {
+ interfaceType = interfaces[i];
+ attributes = interfaceType.GetCustomAttributes(attributeType, false);
+ if (null != attributes && 0 != attributes.Length) {
+ break;
+ }
+ }
+ }
+
+ if (null == attributes || 0 == attributes.Length) {
+ return null;
+ }
+ return (ComProgIdAttribute)attributes[0];
+ }
+
+ /// Constructor
+ /// The COM ProgID.
+ public ComProgIdAttribute(string value) {
+ _value = value;
+ }
+
+ ///
+ /// Returns the COM ProgID
+ ///
+ public string Value {
+ get { return _value; }
+ }
+ }
+}
diff --git a/GreenshotInterop/Interop/IOleWindow.cs b/GreenshotInterop/Interop/IOleWindow.cs
new file mode 100644
index 000000000..2dc4bd5a1
--- /dev/null
+++ b/GreenshotInterop/Interop/IOleWindow.cs
@@ -0,0 +1,32 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop {
+ // 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);
+ }
+}
diff --git a/GreenshotInterop/Interop/IServiceProvider.cs b/GreenshotInterop/Interop/IServiceProvider.cs
new file mode 100644
index 000000000..3a3079dc8
--- /dev/null
+++ b/GreenshotInterop/Interop/IServiceProvider.cs
@@ -0,0 +1,32 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop {
+ // 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);
+ }
+}
diff --git a/GreenshotInterop/OfficeExport/ExcelExporter.cs b/GreenshotInterop/OfficeExport/ExcelExporter.cs
new file mode 100644
index 000000000..d9e077df0
--- /dev/null
+++ b/GreenshotInterop/OfficeExport/ExcelExporter.cs
@@ -0,0 +1,88 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Reflection;
+
+using Greenshot.Interop;
+
+namespace Greenshot.Interop.Office {
+ public class ExcelExporter {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ExcelExporter));
+
+ public static List GetWorkbooks() {
+ List currentWorkbooks = new List();
+ using (IExcelApplication excelApplication = COMWrapper.GetInstance()) {
+ if (excelApplication != null) {
+ for (int i = 1; i <= excelApplication.Workbooks.Count; i++) {
+ IWorkbook workbook = excelApplication.Workbooks[i];
+ if (workbook != null) {
+ currentWorkbooks.Add(workbook.Name);
+ }
+ }
+ }
+ }
+ return currentWorkbooks;
+ }
+
+ ///
+ /// Insert image from supplied tmp file into the give excel workbook
+ ///
+ ///
+ ///
+ public static void InsertIntoExistingWorkbook(string workbookName, string tmpFile) {
+ using (IExcelApplication excelApplication = COMWrapper.GetInstance()) {
+ if (excelApplication != null) {
+ for (int i = 1; i <= excelApplication.Workbooks.Count; i++) {
+ IWorkbook workbook = excelApplication.Workbooks[i];
+ if (workbook != null && workbook.Name.StartsWith(workbookName)) {
+ InsertIntoExistingWorkbook(workbook, tmpFile);
+ }
+ }
+ }
+ }
+ }
+
+ private static void InsertIntoExistingWorkbook(IWorkbook workbook, string tmpFile) {
+ IWorksheet sheet = workbook.ActiveSheet;
+ if (sheet != null) {
+ if (sheet.Pictures != null) {
+ sheet.Pictures.Insert(tmpFile);
+ }
+ } else {
+ LOG.Error("No pictures found");
+ }
+ }
+
+ public static void InsertIntoNewWorkbook(string tmpFile) {
+ using (IExcelApplication excelApplication = COMWrapper.GetOrCreateInstance()) {
+ if (excelApplication != null) {
+ excelApplication.Visible = true;
+ object template = Missing.Value;
+ IWorkbook workbook = excelApplication.Workbooks.Add(template);
+ InsertIntoExistingWorkbook(workbook, tmpFile);
+ }
+ }
+ }
+ }
+
+}
diff --git a/GreenshotInterop/OfficeExport/OneNoteExporter.cs b/GreenshotInterop/OfficeExport/OneNoteExporter.cs
new file mode 100644
index 000000000..51a99bdba
--- /dev/null
+++ b/GreenshotInterop/OfficeExport/OneNoteExporter.cs
@@ -0,0 +1,97 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using Greenshot.Interop;
+using System.Reflection;
+using System.Xml;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+
+namespace Greenshot.Interop.Office {
+ public class OneNotePage {
+ public string PageName { get; set; }
+ public string PageID { get; set; }
+ }
+ public class OneNoteExporter {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OneNoteExporter));
+ private const string XML_IMAGE_CONTENT = "{0}";
+ private const string XML_OUTLINE = "{0}";
+ private const string ONENOTE_NAMESPACE_2007 = "http://schemas.microsoft.com/office/onenote/2007/onenote";
+ private const string ONENOTE_NAMESPACE_2010 = "http://schemas.microsoft.com/office/onenote/2010/onenote";
+
+ public static void ExportToPage(Bitmap imageToExport, OneNotePage page) {
+ using (MemoryStream pngStream = new MemoryStream()) {
+ imageToExport.Save(pngStream, ImageFormat.Png);
+ string base64String = Convert.ToBase64String(pngStream.GetBuffer());
+ string imageXmlStr = string.Format(XML_IMAGE_CONTENT, base64String, imageToExport.Width, imageToExport.Height);
+ string pageChangesXml = string.Format(XML_OUTLINE, new object[] { imageXmlStr, page.PageID, ONENOTE_NAMESPACE_2010, page.PageName });
+ using (IOneNoteApplication oneNoteApplication = COMWrapper.GetOrCreateInstance()) {
+ LOG.InfoFormat("Sending XML: {0}", pageChangesXml);
+ oneNoteApplication.UpdatePageContent(pageChangesXml, DateTime.MinValue, XMLSchema.xs2010, false);
+ }
+ }
+ }
+
+ ///
+ /// Get the captions of all the open word documents
+ ///
+ ///
+ public static List GetPages() {
+ List pages = new List();
+ try {
+ using (IOneNoteApplication oneNoteApplication = COMWrapper.GetOrCreateInstance()) {
+ if (oneNoteApplication != null) {
+ string notebookXml = "";
+ oneNoteApplication.GetHierarchy("", HierarchyScope.hsPages, out notebookXml, XMLSchema.xs2010);
+ if (!string.IsNullOrEmpty(notebookXml)) {
+ LOG.Debug(notebookXml);
+ using (StringReader reader = new StringReader(notebookXml)) {
+ using (XmlTextReader xmlReader = new XmlTextReader(reader)) {
+ while (xmlReader.Read()) {
+ if ("one:Page".Equals(xmlReader.Name)) {
+ if ("true".Equals(xmlReader.GetAttribute("isCurrentlyViewed"))) {
+ OneNotePage page = new OneNotePage();
+ page.PageName = xmlReader.GetAttribute("name");
+ page.PageID = xmlReader.GetAttribute("ID");
+ pages.Add(page);
+ // For debugging
+ //string pageXml = "";
+ //oneNoteApplication.GetPageContent(page.PageID, out pageXml, PageInfo.piAll, XMLSchema.xs2010);
+ //LOG.DebugFormat("Page XML: {0}", pageXml);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ LOG.Warn("Problem retrieving onenote destinations, ignoring: ", ex);
+ }
+ return pages;
+ }
+ }
+}
diff --git a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs
new file mode 100644
index 000000000..5292aa3c5
--- /dev/null
+++ b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs
@@ -0,0 +1,478 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+
+using Microsoft.Win32;
+
+using Greenshot.Interop;
+using Greenshot.Interop.IE;
+using System.Threading;
+
+namespace Greenshot.Interop.Office {
+ ///
+ /// Outlook exporter has all the functionality to export to outlook
+ ///
+ public class OutlookEmailExporter {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OutlookEmailExporter));
+ private static readonly string SIGNATURE_PATH = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Microsoft\Signatures");
+ private static Version outlookVersion = new Version(1, 1, 1, 1);
+ private static string currentUser = null;
+
+ // The signature key can be found at:
+ // HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\\9375CFF0413111d3B88A00104B2A6676\ [New Signature]
+ private const string PROFILES_KEY = @"Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\";
+ private const string ACCOUNT_KEY = "9375CFF0413111d3B88A00104B2A6676";
+ private const string NEW_SIGNATURE_VALUE = "New Signature";
+ private const string DEFAULT_PROFILE_VALUE = "DefaultProfile";
+
+ ///
+ /// A method to retrieve all inspectors which can act as an export target
+ ///
+ /// bool true if also exporting to meetings
+ /// List with inspector captions (window title)
+ public static Dictionary RetrievePossibleTargets(bool allowMeetingAsTarget) {
+ Dictionary inspectorCaptions = new Dictionary();
+ try {
+ using (IOutlookApplication outlookApplication = GetOutlookApplication()) {
+ if (outlookApplication == null) {
+ return null;
+ }
+
+ Inspectors inspectors = outlookApplication.Inspectors;
+ if (inspectors != null && inspectors.Count > 0) {
+ for (int i = 1; i <= inspectors.Count; i++) {
+ Inspector inspector = outlookApplication.Inspectors[i];
+ if (canExportToInspector(inspector, allowMeetingAsTarget)) {
+ Item currentItem = inspector.CurrentItem;
+ OlObjectClass currentItemClass = currentItem.Class;
+ inspectorCaptions.Add(inspector.Caption, currentItemClass);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ LOG.Warn("Problem retrieving word destinations, ignoring: ", ex);
+ }
+ return inspectorCaptions;
+ }
+
+ ///
+ /// Return true if we can export to the supplied inspector
+ ///
+ /// the Inspector to check
+ /// bool true if also exporting to meetings
+ ///
+ private static bool canExportToInspector(Inspector inspector, bool allowMeetingAsTarget) {
+ try {
+ Item currentItem = inspector.CurrentItem;
+ if (currentItem != null) {
+ OlObjectClass currentItemClass = currentItem.Class;
+ if (OlObjectClass.olMail.Equals(currentItemClass)) {
+ MailItem mailItem = COMWrapper.Cast(currentItem);
+ if (!mailItem.Sent) {
+ return true;
+ }
+ } else if (outlookVersion.Major >= 12 && allowMeetingAsTarget && OlObjectClass.olAppointment.Equals(currentItemClass)) {
+ AppointmentItem appointmentItem = COMWrapper.Cast(currentItem);
+ if (string.IsNullOrEmpty(appointmentItem.Organizer) || (currentUser == null && currentUser.Equals(appointmentItem.Organizer))) {
+ return true;
+ } else {
+ LOG.DebugFormat("Not exporting to {0}, as organizer is {1} and currentuser {2}", inspector.Caption, appointmentItem.Organizer, currentUser);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ LOG.WarnFormat("Couldn't process item due to: {0}", ex.Message);
+ }
+ return false;
+ }
+
+
+ ///
+ /// Export the image stored in tmpFile to the Inspector with the caption
+ ///
+ /// Caption of the inspector
+ /// Path to image file
+ /// name of the attachment (used as the tooltip of the image)
+ /// true if it worked
+ public static bool ExportToInspector(string inspectorCaption, string tmpFile, string attachmentName) {
+ // Assume true, although this might cause issues.
+ bool allowMeetingAsTarget = true;
+ using (IOutlookApplication outlookApplication = GetOrCreateOutlookApplication()) {
+ if (outlookApplication != null) {
+ Inspectors inspectors = outlookApplication.Inspectors;
+ if (inspectors != null && inspectors.Count > 0) {
+ LOG.DebugFormat("Got {0} inspectors to check", inspectors.Count);
+ for (int i = 1; i <= inspectors.Count; i++) {
+ Inspector inspector = outlookApplication.Inspectors[i];
+ string currentCaption = inspector.Caption;
+ if (currentCaption.StartsWith(inspectorCaption)) {
+ if (canExportToInspector(inspector, allowMeetingAsTarget)) {
+ try {
+ return ExportToInspector(inspector, tmpFile, attachmentName);
+ } catch (Exception exExport) {
+ LOG.Error("Export to " + currentCaption + " failed.", exExport);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Export the file to the supplied inspector
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static bool ExportToInspector(Inspector inspector, string tmpFile, string attachmentName) {
+ Item currentItem = inspector.CurrentItem;
+ if (currentItem == null) {
+ LOG.Warn("No current item.");
+ return false;
+ }
+ OlObjectClass itemClass = currentItem.Class;
+ bool isMail = OlObjectClass.olMail.Equals(itemClass);
+ bool isAppointment = OlObjectClass.olAppointment.Equals(itemClass);
+ if (!isMail && !isAppointment) {
+ LOG.Warn("Item is no mail or appointment.");
+ return false;
+ }
+ MailItem mailItem = null;
+ try {
+ if (isMail) {
+ mailItem = COMWrapper.Cast(currentItem);
+ if (mailItem.Sent) {
+ LOG.WarnFormat("Item already sent, can't export to {0}", currentItem.Subject);
+ return false;
+ }
+ }
+
+ // Make sure the inspector is activated, only this way the word editor is active!
+ // This also ensures that the window is visible!
+ inspector.Activate();
+
+ // Check for wordmail, if so use the wordexporter
+ // http://msdn.microsoft.com/en-us/library/dd492012%28v=office.12%29.aspx
+ // Earlier versions of Outlook also supported an Inspector.HTMLEditor object property, but since Internet Explorer is no longer the rendering engine for HTML messages and posts, HTMLEditor is no longer supported.
+ if (inspector.IsWordMail() && inspector.WordEditor != null) {
+ if (WordExporter.InsertIntoExistingDocument(inspector.WordEditor, tmpFile)) {
+ LOG.Info("Inserted into Wordmail");
+
+ // check the format afterwards, otherwise we lose the selection
+ //if (!OlBodyFormat.olFormatHTML.Equals(currentMail.BodyFormat)) {
+ // LOG.Info("Changing format to HTML.");
+ // currentMail.BodyFormat = OlBodyFormat.olFormatHTML;
+ //}
+ return true;
+ }
+ } else if (isAppointment) {
+ LOG.Info("Can't export to an appointment if no word editor is used");
+ return false;
+ } else {
+ LOG.Info("Trying export for word < 2007.");
+ }
+ // Only use mailitem as it should be filled!!
+ LOG.InfoFormat("Item '{0}' has format: {1}", mailItem.Subject, mailItem.BodyFormat);
+
+ string contentID;
+ if (outlookVersion.Major >= 12) {
+ contentID = Guid.NewGuid().ToString();
+ } else {
+ LOG.Info("Older Outlook (<2007) found, using filename as contentid.");
+ contentID = Path.GetFileName(tmpFile);
+ }
+
+ // Use this to change the format, it will probably lose the current selection.
+ //if (!OlBodyFormat.olFormatHTML.Equals(currentMail.BodyFormat)) {
+ // LOG.Info("Changing format to HTML.");
+ // currentMail.BodyFormat = OlBodyFormat.olFormatHTML;
+ //}
+
+ bool inlinePossible = false;
+ if (OlBodyFormat.olFormatHTML.Equals(mailItem.BodyFormat)) {
+ // if html we can try to inline it
+ // The following might cause a security popup... can't ignore it.
+ try {
+ IHTMLDocument2 document2 = inspector.HTMLEditor as IHTMLDocument2;
+ if (document2 != null) {
+ IHTMLSelectionObject selection = document2.selection;
+ if (selection != null) {
+ IHTMLTxtRange range = selection.createRange();
+ if (range != null) {
+ // First paste, than attach (otherwise the range is wrong!)
+ range.pasteHTML("

");
+ inlinePossible = true;
+ } else {
+ LOG.DebugFormat("No range for '{0}'", inspector.Caption);
+ }
+ } else {
+ LOG.DebugFormat("No selection for '{0}'", inspector.Caption);
+ }
+ } else {
+ LOG.DebugFormat("No HTML editor for '{0}'", inspector.Caption);
+ }
+ } catch (Exception e) {
+ // Continue with non inline image
+ LOG.Warn("Error pasting HTML, most likely due to an ACCESS_DENIED as the user clicked no.", e);
+ }
+ }
+
+ // Create the attachment (if inlined the attachment isn't visible as attachment!)
+ Attachment attachment = mailItem.Attachments.Add(tmpFile, OlAttachmentType.olByValue, inlinePossible ? 0 : 1, attachmentName);
+ if (outlookVersion.Major >= 12) {
+ // Add the content id to the attachment, this only works for Outlook >= 2007
+ try {
+ PropertyAccessor propertyAccessor = attachment.PropertyAccessor;
+ propertyAccessor.SetProperty(PropTag.ATTACHMENT_CONTENT_ID, contentID);
+ } catch {
+ }
+ }
+ } catch (Exception ex) {
+ LOG.WarnFormat("Problem while trying to add attachment to Item '{0}' : {1}", inspector.Caption, ex);
+ return false;
+ }
+ LOG.Debug("Finished!");
+ return true;
+ }
+ ///
+ /// Export image to a new email
+ ///
+ ///
+ ///
+ ///
+ private static void ExportToNewEmail(IOutlookApplication outlookApplication, EmailFormat format, string tmpFile, string subject, string attachmentName) {
+ Item newItem = outlookApplication.CreateItem(OlItemType.olMailItem);
+ if (newItem == null) {
+ return;
+ }
+ MailItem newMail = COMWrapper.Cast(newItem);
+ newMail.Subject = subject;
+ newMail.BodyFormat = OlBodyFormat.olFormatHTML;
+ string bodyString = null;
+ // Read the default signature, if nothing found use empty email
+ try {
+ bodyString = GetOutlookSignature(format);
+ } catch (Exception e) {
+ LOG.Error("Problem reading signature!", e);
+ }
+ switch (format) {
+ case EmailFormat.Text:
+ newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 1, attachmentName);
+ newMail.BodyFormat = OlBodyFormat.olFormatPlain;
+ if (bodyString == null) {
+ bodyString = "";
+ }
+ newMail.Body = bodyString;
+ break;
+ case EmailFormat.HTML:
+ default:
+ // Create the attachment
+ Attachment attachment = newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 0, attachmentName);
+ // add content ID to the attachment
+ string contentID = Path.GetFileName(tmpFile);
+ if (outlookVersion.Major >= 12) {
+ // Add the content id to the attachment
+ try {
+ contentID = Guid.NewGuid().ToString();
+ PropertyAccessor propertyAccessor = attachment.PropertyAccessor;
+ propertyAccessor.SetProperty(PropTag.ATTACHMENT_CONTENT_ID, contentID);
+ } catch {
+ LOG.Info("Error working with the PropertyAccessor, using filename as contentid");
+ contentID = Path.GetFileName(tmpFile);
+ }
+ }
+
+ newMail.BodyFormat = OlBodyFormat.olFormatHTML;
+ string htmlImgEmbedded = "

";
+ string fallbackBody = "" + htmlImgEmbedded + "";
+ if (bodyString == null) {
+ bodyString = fallbackBody;
+ } else {
+ int bodyIndex = bodyString.IndexOf("= 0) {
+ bodyIndex = bodyString.IndexOf(">", bodyIndex) + 1;
+ if (bodyIndex >= 0) {
+ bodyString = bodyString.Insert(bodyIndex, htmlImgEmbedded);
+ } else {
+ bodyString = fallbackBody;
+ }
+ } else {
+ bodyString = fallbackBody;
+ }
+ }
+ newMail.HTMLBody = bodyString;
+ break;
+ }
+ // So not save, otherwise the email is always stored in Draft folder.. (newMail.Save();)
+ try {
+ newMail.Display(false);
+ newMail.GetInspector().Activate();
+ } catch (Exception ex) {
+ LOG.WarnFormat("Problem displaying the new email, retrying to display it. Problem: {0}", ex.Message);
+ Thread retryDisplayEmail = new Thread(delegate() {
+ int retries = 60;
+ int retryInXSeconds = 5;
+ while (retries-- > 0) {
+ Thread.Sleep(retryInXSeconds * 1000);
+ try {
+ newMail.Display(false);
+ newMail.GetInspector().Activate();
+ LOG.InfoFormat("Managed to display the message.");
+ return;
+ } catch (Exception) {
+ LOG.WarnFormat("Retrying to show email in {0} seconds... Retries left: {1}", retryInXSeconds, retries);
+ }
+ }
+ LOG.WarnFormat("Retry failed, saving message to draft.");
+ newMail.Save();
+ });
+ retryDisplayEmail.Name = "Retry to display email";
+ retryDisplayEmail.IsBackground = true;
+ retryDisplayEmail.Start();
+ }
+ }
+
+ ///
+ /// Helper method to create an outlook mail item with attachment
+ ///
+ /// The file to send, do not delete the file right away!
+ /// true if it worked, false if not
+ public static bool ExportToOutlook(EmailFormat format, string tmpFile, string subject, string attachmentName) {
+ bool exported = false;
+ try {
+ using (IOutlookApplication outlookApplication = GetOrCreateOutlookApplication()) {
+ if (outlookApplication != null) {
+ ExportToNewEmail(outlookApplication, format, tmpFile, subject, attachmentName);
+ exported = true;
+ }
+ }
+ return exported;
+ } catch (Exception e) {
+ LOG.Error("Error while creating an outlook mail item: ", e);
+ }
+ return exported;
+ }
+
+ ///
+ /// Helper method to get the Outlook signature
+ ///
+ ///
+ private static string GetOutlookSignature(EmailFormat format) {
+ using (RegistryKey profilesKey = Registry.CurrentUser.OpenSubKey(PROFILES_KEY, false)) {
+ if (profilesKey == null) {
+ return null;
+ }
+ string defaultProfile = (string)profilesKey.GetValue(DEFAULT_PROFILE_VALUE);
+ LOG.DebugFormat("defaultProfile={0}", defaultProfile);
+ using (RegistryKey profileKey = profilesKey.OpenSubKey(defaultProfile + @"\" + ACCOUNT_KEY, false)) {
+ if (profilesKey == null) {
+ return null;
+ }
+ string[] numbers = profileKey.GetSubKeyNames();
+ foreach (string number in numbers) {
+ LOG.DebugFormat("Found subkey {0}", number);
+ using (RegistryKey numberKey = profileKey.OpenSubKey(number, false)) {
+ byte[] val = (byte[])numberKey.GetValue(NEW_SIGNATURE_VALUE);
+ if (val == null) {
+ continue;
+ }
+ string signatureName = "";
+ foreach (byte b in val) {
+ if (b != 0) {
+ signatureName += (char)b;
+ }
+ }
+ LOG.DebugFormat("Found email signature: {0}", signatureName);
+ string extension;
+ switch (format) {
+ case EmailFormat.Text:
+ extension = ".txt";
+ break;
+ case EmailFormat.HTML:
+ default:
+ extension = ".htm";
+ break;
+ }
+ string signatureFile = Path.Combine(SIGNATURE_PATH, signatureName + extension);
+ if (File.Exists(signatureFile)) {
+ LOG.DebugFormat("Found email signature file: {0}", signatureFile);
+ return File.ReadAllText(signatureFile, Encoding.Default);
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ ///
+ /// Initialize static outlook variables like version and currentuser
+ ///
+ ///
+ private static void InitializeVariables(IOutlookApplication outlookApplication) {
+ if (outlookApplication == null) {
+ return;
+ }
+ try {
+ outlookVersion = new Version(outlookApplication.Version);
+ LOG.InfoFormat("Using Outlook {0}", outlookVersion);
+ } catch (Exception exVersion) {
+ LOG.Error(exVersion);
+ }
+ try {
+ INameSpace mapiNamespace = outlookApplication.GetNameSpace("MAPI");
+ currentUser = mapiNamespace.CurrentUser.Name;
+ LOG.InfoFormat("Current user: {0}", currentUser);
+ } catch (Exception exNS) {
+ LOG.Error(exNS);
+ }
+ }
+
+ ///
+ /// Call this to get the running outlook application, returns null if there isn't any.
+ ///
+ /// IOutlookApplication or null
+ private static IOutlookApplication GetOutlookApplication() {
+ IOutlookApplication outlookApplication = COMWrapper.GetInstance();
+ InitializeVariables(outlookApplication);
+ return outlookApplication;
+ }
+
+ ///
+ /// Call this to get the running outlook application, or create a new instance
+ ///
+ /// IOutlookApplication
+ private static IOutlookApplication GetOrCreateOutlookApplication() {
+ IOutlookApplication outlookApplication = COMWrapper.GetOrCreateInstance();
+ InitializeVariables(outlookApplication);
+ return outlookApplication;
+ }
+ }
+
+}
diff --git a/GreenshotInterop/OfficeExport/PowerpointExporter.cs b/GreenshotInterop/OfficeExport/PowerpointExporter.cs
new file mode 100644
index 000000000..990c206ac
--- /dev/null
+++ b/GreenshotInterop/OfficeExport/PowerpointExporter.cs
@@ -0,0 +1,132 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Text;
+
+using Greenshot.Interop;
+
+namespace Greenshot.Interop.Office {
+ public class PowerpointExporter {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PowerpointExporter));
+
+ ///
+ /// Get the captions of all the open powerpoint presentations
+ ///
+ ///
+ public static System.Collections.Generic.List GetPowerpointPresentations() {
+ System.Collections.Generic.List presentations = new System.Collections.Generic.List();
+ try {
+ using (IPowerpointApplication powerpointApplication = COMWrapper.GetInstance()) {
+ if (powerpointApplication != null) {
+ LOG.DebugFormat("Open Presentations: {0}", powerpointApplication.Presentations.Count);
+ for (int i = 1; i <= powerpointApplication.Presentations.Count; i++) {
+ IPresentation presentation = powerpointApplication.Presentations.item(i);
+ if (presentation != null) {
+ presentations.Add(presentation.Name);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ LOG.Warn("Problem retrieving word destinations, ignoring: ", ex);
+ }
+
+ return presentations;
+ }
+
+ ///
+ /// Export the image from the tmpfile to the presentation with the supplied name
+ ///
+ /// Name of the presentation to insert to
+ /// Filename of the image file to insert
+ /// Size of the image
+ /// A string with the image title
+ ///
+ public static bool ExportToPresentation(string presentationName, string tmpFile, Size imageSize, string title) {
+ using (IPowerpointApplication powerpointApplication = COMWrapper.GetInstance()) {
+ if (powerpointApplication != null) {
+ LOG.DebugFormat("Open Presentations: {0}", powerpointApplication.Presentations.Count);
+ for (int i = 1; i <= powerpointApplication.Presentations.Count; i++) {
+ IPresentation presentation = powerpointApplication.Presentations.item(i);
+ if (presentation != null && presentation.Name.StartsWith(presentationName)) {
+ try {
+ AddPictureToPresentation(presentation, tmpFile, imageSize, title);
+ return true;
+ } catch (Exception e) {
+ LOG.Error(e);
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private static void AddPictureToPresentation(IPresentation presentation, string tmpFile, Size imageSize, string title) {
+ if (presentation != null) {
+ //ISlide slide = presentation.Slides.AddSlide( presentation.Slides.Count + 1, PPSlideLayout.ppLayoutPictureWithCaption);
+ ISlide slide;
+ float left = 0;
+ float top = 0;
+ bool isLayoutPictureWithCaption = false;
+ try {
+ slide = presentation.Slides.Add(presentation.Slides.Count + 1, (int)PPSlideLayout.ppLayoutPictureWithCaption);
+ isLayoutPictureWithCaption = true;
+ // Shapes[2] is the image shape on this layout.
+ IShape shapeForLocation = slide.Shapes.item(2);
+ shapeForLocation.Width = imageSize.Width;
+ shapeForLocation.Height = imageSize.Height;
+ left = shapeForLocation.Left;
+ top = shapeForLocation.Top;
+ LOG.DebugFormat("Shape {0},{1},{2},{3}", shapeForLocation.Left, shapeForLocation.Top, imageSize.Width, imageSize.Height);
+ } catch (Exception e) {
+ LOG.Error(e);
+ slide = presentation.Slides.Add(presentation.Slides.Count + 1, (int)PPSlideLayout.ppLayoutBlank);
+ }
+ IShape shape = slide.Shapes.AddPicture(tmpFile, MsoTriState.msoFalse, MsoTriState.msoTrue, left, top, imageSize.Width, imageSize.Height);
+ shape.Width = imageSize.Width;
+ shape.Height = imageSize.Height;
+ shape.ScaleWidth(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromMiddle);
+ shape.ScaleHeight(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromMiddle);
+ if (isLayoutPictureWithCaption) {
+ try {
+ // Using try/catch to make sure problems with the text range don't give an exception.
+ shape.TextFrame.TextRange.Text = title;
+ } catch (Exception ex) {
+ LOG.WarnFormat("Problem setting the title to a text-range: {0}", ex.Message);
+ }
+ }
+ }
+ }
+
+ public static void InsertIntoNewPresentation(string tmpFile, Size imageSize, string title) {
+ using (IPowerpointApplication powerpointApplication = COMWrapper.GetOrCreateInstance()) {
+ if (powerpointApplication != null) {
+ powerpointApplication.Visible = true;
+ IPresentation presentation = powerpointApplication.Presentations.Add(MsoTriState.msoTrue);
+ AddPictureToPresentation(presentation, tmpFile, imageSize, title);
+ }
+ }
+ }
+ }
+}
diff --git a/GreenshotInterop/OfficeExport/WordExporter.cs b/GreenshotInterop/OfficeExport/WordExporter.cs
new file mode 100644
index 000000000..0ae2694f2
--- /dev/null
+++ b/GreenshotInterop/OfficeExport/WordExporter.cs
@@ -0,0 +1,112 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using Greenshot.Interop;
+
+namespace Greenshot.Interop.Office {
+ public class WordExporter {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WordExporter));
+
+ ///
+ /// Insert the bitmap stored under the tempfile path into the word document with the supplied caption
+ ///
+ ///
+ ///
+ ///
+ public static bool InsertIntoExistingDocument(string wordCaption, string tmpFile) {
+ using (IWordApplication wordApplication = COMWrapper.GetInstance()) {
+ if (wordApplication != null) {
+ for (int i = 1; i <= wordApplication.Documents.Count; i++) {
+ IWordDocument wordDocument = wordApplication.Documents.item(i);
+ if (wordDocument.ActiveWindow.Caption.StartsWith(wordCaption)) {
+ return InsertIntoExistingDocument(wordDocument, tmpFile);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ internal static bool InsertIntoExistingDocument(IWordDocument wordDocument, string tmpFile) {
+ if (wordDocument.Application.Selection != null) {
+ AddPictureToSelection(wordDocument.Application.Selection, tmpFile);
+ try {
+ wordDocument.ActiveWindow.ActivePane.View.Zoom.Percentage = 100;
+ } catch (Exception e) {
+ if (e.InnerException != null) {
+ LOG.WarnFormat("Couldn't set zoom to 100, error: {0}", e.InnerException.Message);
+ } else {
+ LOG.WarnFormat("Couldn't set zoom to 100, error: {0}", e.Message);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private static void AddPictureToSelection(ISelection selection, string tmpFile) {
+ selection.InlineShapes.AddPicture(tmpFile, Type.Missing, Type.Missing, Type.Missing);
+ //selection.InsertAfter("blablub\r\n");
+ }
+
+ public static void InsertIntoNewDocument(string tmpFile) {
+ using (IWordApplication wordApplication = COMWrapper.GetOrCreateInstance()) {
+ if (wordApplication != null) {
+ wordApplication.Visible = true;
+
+ // Create new Document
+ object template = string.Empty;
+ object newTemplate = false;
+ object documentType = 0;
+ object documentVisible = true;
+ wordApplication.Documents.Add(ref template, ref newTemplate, ref documentType, ref documentVisible);
+ // Add Picture
+ AddPictureToSelection(wordApplication.Selection, tmpFile);
+ }
+ }
+ }
+
+ ///
+ /// Get the captions of all the open word documents
+ ///
+ ///
+ public static List GetWordDocuments() {
+ List documents = new List();
+ try {
+ using (IWordApplication wordApplication = COMWrapper.GetInstance()) {
+ if (wordApplication != null) {
+ //documents.Add(wordApplication.ActiveDocument);
+ for (int i = 1; i <= wordApplication.Documents.Count; i++) {
+ IWordDocument document = wordApplication.Documents.item(i);
+ documents.Add(document.ActiveWindow.Caption);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ LOG.Warn("Problem retrieving word destinations, ignoring: ", ex);
+ }
+ return documents;
+ }
+ }
+}
diff --git a/GreenshotInterop/OfficeInterop/ExcelInterop.cs b/GreenshotInterop/OfficeInterop/ExcelInterop.cs
new file mode 100644
index 000000000..7d44e4756
--- /dev/null
+++ b/GreenshotInterop/OfficeInterop/ExcelInterop.cs
@@ -0,0 +1,64 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using Greenshot.Interop;
+
+namespace Greenshot.Interop.Office {
+ // See http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.application.aspx
+ [ComProgId("Excel.Application")]
+ public interface IExcelApplication : Common {
+ IWorkbook ActiveWorkbook { get; }
+ //ISelection Selection {get;}
+ IWorkbooks Workbooks { get; }
+ bool Visible { get; set; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.aspx
+ public interface IWorkbooks : Common, Collection {
+ IWorkbook Add(object template);
+ IWorkbook this[object Index] { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbook.aspx
+ public interface IWorkbook : Common {
+ IWorksheet ActiveSheet { get; }
+ string Name { get; }
+ void Activate();
+ IWorksheets Worksheets { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._worksheet_members.aspx
+ public interface IWorksheet : Common {
+ IPictures Pictures { get; }
+ string Name { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.iworksheets_members.aspx
+ public interface IWorksheets : Common, Collection {
+ Object this[object Index] { get; }
+ }
+
+ public interface IPictures : Common, Collection {
+ void Insert(string file);
+ }
+}
diff --git a/GreenshotInterop/OfficeInterop/OfficeInterop.cs b/GreenshotInterop/OfficeInterop/OfficeInterop.cs
new file mode 100644
index 000000000..4e379daa6
--- /dev/null
+++ b/GreenshotInterop/OfficeInterop/OfficeInterop.cs
@@ -0,0 +1,378 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections;
+
+namespace Greenshot.Interop.Office {
+ ///
+ /// Common properties that has appreared in almost all objects
+ ///
+ public interface Common : IDisposable {
+ }
+
+ public interface Collection : Common, IEnumerable {
+ int Count { get; }
+ void Remove(int index);
+ }
+
+ ///
+ /// See: http://msdn.microsoft.com/en-us/library/bb208387%28v=office.12%29.aspx
+ ///
+ public interface Items : Collection, IEnumerable {
+ Item this[object index] { get; }
+ Item GetFirst();
+ Item GetNext();
+ Item GetLast();
+ Item GetPrevious();
+
+ bool IncludeRecurrences {
+ get;
+ set;
+ }
+
+ Items Restrict(string filter);
+ void Sort(string property, object descending);
+
+ // Actual definition is "object Add( object )", just making it convenient
+ object Add(OlItemType type);
+ }
+
+ // Common attributes of all the Items (MailItem, AppointmentItem)
+ // See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
+ public interface Item : Common {
+ Attachments Attachments { get; }
+ string Body { get; set; }
+ OlObjectClass Class { get; }
+ DateTime CreationTime { get; }
+ string EntryID { get; }
+ DateTime LastModificationTime { get; }
+ string MessageClass { get; set; }
+ bool NoAging { get; set; }
+ int OutlookInternalVersion { get; }
+ string OutlookVersion { get; }
+ bool Saved { get; }
+ OlSensitivity Sensitivity { get; set; }
+ int Size { get; }
+ string Subject { get; set; }
+ bool UnRead { get; set; }
+ object Copy();
+ void Display(bool Modal);
+ void Save();
+ PropertyAccessor PropertyAccessor { get; }
+ Inspector GetInspector();
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
+ public interface MailItem : Item, Common {
+ bool Sent { get; }
+ object MAPIOBJECT { get; }
+ string HTMLBody { get; set; }
+ DateTime ExpiryTime { get; set; }
+ DateTime ReceivedTime { get; }
+ string SenderName { get; }
+ DateTime SentOn { get; }
+ OlBodyFormat BodyFormat { get; set; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/ff869026.aspx
+ public interface AppointmentItem : Item, Common {
+ string Organizer { get; set; }
+ string SendUsingAccount { get; }
+ string Categories { get; }
+ DateTime Start { get; }
+ DateTime End { get; }
+ OlReoccurenceState RecurrenceState { get; }
+ }
+
+ public interface Attachments : Collection {
+ Attachment Add(object source, object type, object position, object displayName);
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.attachment_members.aspx
+ public interface Attachment : Common {
+ string DisplayName { get; set; }
+ string FileName { get; }
+ OlAttachmentType Type { get; }
+ PropertyAccessor PropertyAccessor { get; }
+ object MAPIOBJECT { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.propertyaccessor_members.aspx
+ public interface PropertyAccessor : Common {
+ void SetProperty(string SchemaName, Object Value);
+ Object GetProperty(string SchemaName);
+ }
+
+ public enum OlBodyFormat {
+ // Fields
+ olFormatHTML = 2,
+ olFormatPlain = 1,
+ olFormatRichText = 3,
+ olFormatUnspecified = 0
+ }
+
+ public enum OlAttachmentType {
+ // Fields
+ olByReference = 4,
+ olByValue = 1,
+ olEmbeddeditem = 5,
+ olOLE = 6
+ }
+
+ public enum OlSensitivity {
+ // Fields
+ olConfidential = 3,
+ olNormal = 0,
+ olPersonal = 1,
+ olPrivate = 2
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/ff863329.aspx
+ public enum OlObjectClass {
+ olAccount = 105, // Represents an Account object.
+ olAccountRuleCondition = 135, // Represents an AccountRuleCondition object.
+ olAccounts = 106, // Represents an Accounts object.
+ olAction = 32, // Represents an Action object.
+ olActions = 33, // Represents an Actions object.
+ olAddressEntries = 21, // Represents an AddressEntries object.
+ olAddressEntry = 8, // Represents an AddressEntry object.
+ olAddressList = 7, // Represents an AddressList object.
+ olAddressLists = 20, // Represents an AddressLists object.
+ olAddressRuleCondition = 170, // Represents an AddressRuleCondition object.
+ olApplication = 0, // Represents an Application object.
+ olAppointment = 26, // Represents an AppointmentItem object.
+ olAssignToCategoryRuleAction = 122, // Represents an AssignToCategoryRuleAction object.
+ olAttachment = 5, // Represents an Attachment object.
+ olAttachments = 18, // Represents an Attachments object.
+ olAttachmentSelection = 169, // Represents an AttachmentSelection object.
+ olAutoFormatRule = 147, // Represents an AutoFormatRule object.
+ olAutoFormatRules = 148, // Represents an AutoFormatRules object.
+ olCalendarModule = 159, // Represents a CalendarModule object.
+ olCalendarSharing = 151, // Represents a CalendarSharing object.
+ olCategories = 153, // Represents a Categories object.
+ olCategory = 152, // Represents a Category object.
+ olCategoryRuleCondition = 130, // Represents a CategoryRuleCondition object.
+ olClassBusinessCardView = 168, // Represents a BusinessCardView object.
+ olClassCalendarView = 139, // Represents a CalendarView object.
+ olClassCardView = 138, // Represents a CardView object.
+ olClassIconView = 137, // Represents a IconView object.
+ olClassNavigationPane = 155, // Represents a NavigationPane object.
+ olClassTableView = 136, // Represents a TableView object.
+ olClassTimeLineView = 140, // Represents a TimelineView object.
+ olClassTimeZone = 174, // Represents a TimeZone object.
+ olClassTimeZones = 175, // Represents a TimeZones object.
+ olColumn = 154, // Represents a Column object.
+ olColumnFormat = 149, // Represents a ColumnFormat object.
+ olColumns = 150, // Represents a Columns object.
+ olConflict = 102, // Represents a Conflict object.
+ olConflicts = 103, // Represents a Conflicts object.
+ olContact = 40, // Represents a ContactItem object.
+ olContactsModule = 160, // Represents a ContactsModule object.
+ olDistributionList = 69, // Represents a ExchangeDistributionList object.
+ olDocument = 41, // Represents a DocumentItem object.
+ olException = 30, // Represents an Exception object.
+ olExceptions = 29, // Represents an Exceptions object.
+ olExchangeDistributionList = 111, // Represents an ExchangeDistributionList object.
+ olExchangeUser = 110, // Represents an ExchangeUser object.
+ olExplorer = 34, // Represents an Explorer object.
+ olExplorers = 60, // Represents an Explorers object.
+ olFolder = 2, // Represents a Folder object.
+ olFolders = 15, // Represents a Folders object.
+ olFolderUserProperties = 172, // Represents a UserDefinedProperties object.
+ olFolderUserProperty = 171, // Represents a UserDefinedProperty object.
+ olFormDescription = 37, // Represents a FormDescription object.
+ olFormNameRuleCondition = 131, // Represents a FormNameRuleCondition object.
+ olFormRegion = 129, // Represents a FormRegion object.
+ olFromRssFeedRuleCondition = 173, // Represents a FromRssFeedRuleCondition object.
+ olFromRuleCondition = 132, // Represents a ToOrFromRuleCondition object.
+ olImportanceRuleCondition = 128, // Represents an ImportanceRuleCondition object.
+ olInspector = 35, // Represents an Inspector object.
+ olInspectors = 61, // Represents an Inspectors object.
+ olItemProperties = 98, // Represents an ItemProperties object.
+ olItemProperty = 99, // Represents an ItemProperty object.
+ olItems = 16, // Represents an Items object.
+ olJournal = 42, // Represents a JournalItem object.
+ olJournalModule = 162, // Represents a JournalModule object.
+ olLink = 75, // Represents a Link object.
+ olLinks = 76, // Represents a Links object.
+ olMail = 43, // Represents a MailItem object.
+ olMailModule = 158, // Represents a MailModule object.
+ olMarkAsTaskRuleAction = 124, // Represents a MarkAsTaskRuleAction object.
+ olMeetingCancellation = 54, // Represents a MeetingItem object that is a meeting cancellation notice.
+ olMeetingRequest = 53, // Represents a MeetingItem object that is a meeting request.
+ olMeetingResponseNegative = 55, // Represents a MeetingItem object that is a refusal of a meeting request.
+ olMeetingResponsePositive = 56, // Represents a MeetingItem object that is an acceptance of a meeting request.
+ olMeetingResponseTentative = 57, // Represents a MeetingItem object that is a tentative acceptance of a meeting request.
+ olMoveOrCopyRuleAction = 118, // Represents a MoveOrCopyRuleAction object.
+ olNamespace = 1, // Represents a NameSpace object.
+ olNavigationFolder = 167, // Represents a NavigationFolder object.
+ olNavigationFolders = 166, // Represents a NavigationFolders object.
+ olNavigationGroup = 165, // Represents a NavigationGroup object.
+ olNavigationGroups = 164, // Represents a NavigationGroups object.
+ olNavigationModule = 157, // Represents a NavigationModule object.
+ olNavigationModules = 156, // Represents a NavigationModules object.
+ olNewItemAlertRuleAction = 125, // Represents a NewItemAlertRuleAction object.
+ olNote = 44, // Represents a NoteItem object.
+ olNotesModule = 163, // Represents a NotesModule object.
+ olOrderField = 144, // Represents an OrderField object.
+ olOrderFields = 145, // Represents an OrderFields object.
+ olOutlookBarGroup = 66, // Represents an OutlookBarGroup object.
+ olOutlookBarGroups = 65, // Represents an OutlookBarGroups object.
+ olOutlookBarPane = 63, // Represents an OutlookBarPane object.
+ olOutlookBarShortcut = 68, // Represents an OutlookBarShortcut object.
+ olOutlookBarShortcuts = 67, // Represents an OutlookBarShortcuts object.
+ olOutlookBarStorage = 64, // Represents an OutlookBarStorage object.
+ olPages = 36, // Represents a Pages object.
+ olPanes = 62, // Represents a Panes object.
+ olPlaySoundRuleAction = 123, // Represents a PlaySoundRuleAction object.
+ olPost = 45, // Represents a PostItem object.
+ olPropertyAccessor = 112, // Represents a PropertyAccessor object.
+ olPropertyPages = 71, // Represents a PropertyPages object.
+ olPropertyPageSite = 70, // Represents a PropertyPageSite object.
+ olRecipient = 4, // Represents a Recipient object.
+ olRecipients = 17, // Represents a Recipients object.
+ olRecurrencePattern = 28, // Represents a RecurrencePattern object.
+ olReminder = 101, // Represents a Reminder object.
+ olReminders = 100, // Represents a Reminders object.
+ olRemote = 47, // Represents a RemoteItem object.
+ olReport = 46, // Represents a ReportItem object.
+ olResults = 78, // Represents a Results object.
+ olRow = 121, // Represents a Row object.
+ olRule = 115, // Represents a Rule object.
+ olRuleAction = 117, // Represents a RuleAction object.
+ olRuleActions = 116, // Represents a RuleAction object.
+ olRuleCondition = 127, // Represents a RuleCondition object.
+ olRuleConditions = 126, // Represents a RuleConditions object.
+ olRules = 114, // Represents a Rules object.
+ olSearch = 77, // Represents a Search object.
+ olSelection = 74, // Represents a Selection object.
+ olSelectNamesDialog = 109, // Represents a SelectNamesDialog object.
+ olSenderInAddressListRuleCondition = 133, // Represents a SenderInAddressListRuleCondition object.
+ olSendRuleAction = 119, // Represents a SendRuleAction object.
+ olSharing = 104, // Represents a SharingItem object.
+ olStorageItem = 113, // Represents a StorageItem object.
+ olStore = 107, // Represents a Store object.
+ olStores = 108, // Represents a Stores object.
+ olSyncObject = 72, // Represents a SyncObject object.
+ olSyncObjects = 73, // Represents a SyncObject object.
+ olTable = 120, // Represents a Table object.
+ olTask = 48, // Represents a TaskItem object.
+ olTaskRequest = 49, // Represents a TaskRequestItem object.
+ olTaskRequestAccept = 51, // Represents a TaskRequestAcceptItem object.
+ olTaskRequestDecline = 52, // Represents a TaskRequestDeclineItem object.
+ olTaskRequestUpdate = 50, // Represents a TaskRequestUpdateItem object.
+ olTasksModule = 161, // Represents a TasksModule object.
+ olTextRuleCondition = 134, // Represents a TextRuleCondition object.
+ olUserDefinedProperties = 172, // Represents a UserDefinedProperties object.
+ olUserDefinedProperty = 171, // Represents a UserDefinedProperty object.
+ olUserProperties = 38, // Represents a UserProperties object.
+ olUserProperty = 39, // Represents a UserProperty object.
+ olView = 80, // Represents a View object.
+ olViewField = 142, // Represents a ViewField object.
+ olViewFields = 141, // Represents a ViewFields object.
+ olViewFont = 146, // Represents a ViewFont object.
+ olViews = 79 // Represents a Views object.
+ }
+
+ public enum OlDefaultFolders {
+ olFolderCalendar = 9, // The Calendar folder.
+ olFolderConflicts = 19, // The Conflicts folder (subfolder of Sync Issues folder). Only available for an Exchange account.
+ olFolderContacts = 10, // The Contacts folder.
+ olFolderDeletedItems = 3, // The Deleted Items folder.
+ olFolderDrafts = 16, // The Drafts folder.
+ olFolderInbox = 6, // The Inbox folder.
+ olFolderJournal = 11, // The Journal folder.
+ olFolderJunk = 23, // The Junk E-Mail folder.
+ olFolderLocalFailures = 21, // The Local Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
+ olFolderManagedEmail = 29, // The top-level folder in the Managed Folders group. For more information on Managed Folders, see Help in Microsoft Outlook. Only available for an Exchange account.
+ olFolderNotes = 12, // The Notes folder.
+ olFolderOutbox = 4, // The Outbox folder.
+ olFolderSentMail = 5, // The Sent Mail folder.
+ olFolderServerFailures = 22, // The Server Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
+ olFolderSyncIssues = 20, // The Sync Issues folder. Only available for an Exchange account.
+ olFolderTasks = 13, // The Tasks folder.
+ olFolderToDo = 28, // The To Do folder.
+ olPublicFoldersAllPublicFolders = 18, // The All Public Folders folder in the Exchange Public Folders store. Only available for an Exchange account.
+ olFolderRssFeeds = 25 // The RSS Feeds folder.
+ }
+
+ public enum OlItemType {
+ // Fields
+ olAppointmentItem = 1,
+ olContactItem = 2,
+ olDistributionListItem = 7,
+ olJournalItem = 4,
+ olMailItem = 0,
+ olNoteItem = 5,
+ olPostItem = 6,
+ olTaskItem = 3
+ }
+
+ public enum OlEditorType {
+ // Fields
+ olEditorHTML = 2,
+ olEditorRTF = 3,
+ olEditorText = 1,
+ olEditorWord = 4
+ }
+
+ public enum OlWindowState {
+ // Fields
+ olMaximized = 0,
+ olMinimized = 1,
+ olNormalWindow = 2
+ }
+
+ public enum OlInspectorClose {
+ // Fields
+ olDiscard = 1,
+ olPromptForSave = 2,
+ olSave = 0
+ }
+
+ public enum MsoTriState {
+ msoTrue = -1,
+ msoFalse = 0,
+ msoCTrue = 1,
+ msoTriStateToggle = -3,
+ msoTriStateMixed = -2
+ }
+
+ public enum OlReoccurenceState {
+ olApptException,
+ olApptMaster,
+ olApptNotRecurring,
+ olApptOccurrence
+ }
+
+ public enum MsoScaleFrom {
+ msoScaleFromTopLeft = 0,
+ msoScaleFromMiddle = 1,
+ msoScaleFromBottomRight = 2
+ }
+
+ // Schema definitions for the MAPI properties
+ // See: http://msdn.microsoft.com/en-us/library/aa454438.aspx
+ // and see: http://msdn.microsoft.com/en-us/library/bb446117.aspx
+ public static class PropTag {
+ public const string ATTACHMENT_CONTENT_ID = @"http://schemas.microsoft.com/mapi/proptag/0x3712001E";
+ }
+}
diff --git a/GreenshotInterop/OfficeInterop/OneNoteInterop.cs b/GreenshotInterop/OfficeInterop/OneNoteInterop.cs
new file mode 100644
index 000000000..079e03f08
--- /dev/null
+++ b/GreenshotInterop/OfficeInterop/OneNoteInterop.cs
@@ -0,0 +1,62 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Xml.Schema;
+using Greenshot.Interop;
+
+namespace Greenshot.Interop.Office {
+ // More details about OneNote: http://msdn.microsoft.com/en-us/magazine/ff796230.aspx
+
+ // See http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.applicationclass_members%28v=Office.11%29.aspx
+ [ComProgId("OneNote.Application")]
+ public interface IOneNoteApplication : Common {
+ ///
+ /// Make sure that the notebookXml is of type string, e.g. "", otherwise a type error occurs.
+ /// For more info on the methods: http://msdn.microsoft.com/en-us/library/gg649853.aspx
+ ///
+ void GetHierarchy(string startNode, HierarchyScope scope, out string notebookXml, XMLSchema schema);
+ void UpdatePageContent(string pageChangesXml, DateTime dateExpectedLastModified, XMLSchema schema, bool force);
+ void GetPageContent(string pageId, out string pageXml, PageInfo pageInfoToExport, XMLSchema schema);
+ }
+
+ public enum PageInfo {
+ piBasic = 0, // Returns only basic page content, without selection markup and binary data objects. This is the standard value to pass.
+ piBinaryData = 1, // Returns page content with no selection markup, but with all binary data.
+ piSelection = 2, // Returns page content with selection markup, but no binary data.
+ piBinaryDataSelection = 3, // Returns page content with selection markup and all binary data.
+ piAll = 3 // Returns all page content.
+ }
+
+ public enum HierarchyScope {
+ hsSelf = 0, // Gets just the start node specified and no descendants.
+ hsChildren = 1, //Gets the immediate child nodes of the start node, and no descendants in higher or lower subsection groups.
+ hsNotebooks = 2, // Gets all notebooks below the start node, or root.
+ hsSections = 3, //Gets all sections below the start node, including sections in section groups and subsection groups.
+ hsPages = 4 //Gets all pages below the start node, including all pages in section groups and subsection groups.
+ }
+
+ public enum XMLSchema {
+ xs2007 = 0,
+ xs2010 = 1,
+ xsCurrent= xs2010
+ }
+}
diff --git a/GreenshotInterop/OfficeInterop/OutlookInterop.cs b/GreenshotInterop/OfficeInterop/OutlookInterop.cs
new file mode 100644
index 000000000..b46667ba2
--- /dev/null
+++ b/GreenshotInterop/OfficeInterop/OutlookInterop.cs
@@ -0,0 +1,98 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+///
+/// This utils class should help setting the content-id on the attachment for Outlook < 2007
+/// But this somehow doesn't work yet
+///
+namespace Greenshot.Interop.Office {
+ ///
+ /// Wrapper for Outlook.Application, see: http://msdn.microsoft.com/en-us/library/aa210897%28v=office.11%29.aspx
+ ///
+ [ComProgId("Outlook.Application")]
+ public interface IOutlookApplication : Common {
+ string Name { get; }
+ string Version { get; }
+ Item CreateItem(OlItemType ItemType);
+ object CreateItemFromTemplate(string TemplatePath, object InFolder);
+ object CreateObject(string ObjectName);
+ Inspector ActiveInspector();
+ Inspectors Inspectors { get; }
+ INameSpace GetNameSpace(string type);
+ }
+
+ ///
+ /// See: http://msdn.microsoft.com/en-us/library/bb176693%28v=office.12%29.aspx
+ ///
+ public interface INameSpace : Common {
+ IRecipient CurrentUser { get; }
+ IFolder GetDefaultFolder(OlDefaultFolders defaultFolder);
+ }
+
+ ///
+ /// See: http://msdn.microsoft.com/en-us/library/bb176362%28v=office.12%29.aspx
+ ///
+ public interface IFolder : Common {
+ Items Items {get;}
+ }
+
+ public interface IRecipient : Common {
+ string Name { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspector_members.aspx
+ public interface Inspector : Common {
+ Item CurrentItem { get; }
+ OlEditorType EditorType { get; }
+ object ModifiedFormPages { get; }
+ void Close(OlInspectorClose SaveMode);
+ void Display(object Modal);
+ void HideFormPage(string PageName);
+ bool IsWordMail();
+ void SetCurrentFormPage(string PageName);
+ void ShowFormPage(string PageName);
+ object HTMLEditor { get; }
+ IWordDocument WordEditor { get; }
+ string Caption { get; }
+ int Height { get; set; }
+ int Left { get; set; }
+ int Top { get; set; }
+ int Width { get; set; }
+ OlWindowState WindowState { get; set; }
+ void Activate();
+ void SetControlItemProperty(object Control, string PropertyName);
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._application.inspectors.aspx
+ public interface Inspectors : Common, Collection, IEnumerable {
+ Inspector this[Object Index] { get; }
+ }
+
+ ///
+ /// Specifies which EmailFormat the email needs to use
+ ///
+ public enum EmailFormat {
+ Text, HTML
+ }
+}
diff --git a/GreenshotInterop/OfficeInterop/OutlookUtils.cs b/GreenshotInterop/OfficeInterop/OutlookUtils.cs
new file mode 100644
index 000000000..e921e618b
--- /dev/null
+++ b/GreenshotInterop/OfficeInterop/OutlookUtils.cs
@@ -0,0 +1,853 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Runtime.InteropServices;
+
+namespace Greenshot.Interop.Office {
+ enum PT : uint {
+ PT_UNSPECIFIED = 0, /* (Reserved for interface use) type doesn't matter to caller */
+ PT_NULL = 1, /* NULL property value */
+ PT_I2 = 2, /* Signed 16-bit value */
+ PT_LONG = 3, /* Signed 32-bit value */
+ PT_R4 = 4, /* 4-byte floating point */
+ PT_DOUBLE = 5, /* Floating point double */
+ PT_CURRENCY = 6, /* Signed 64-bit int (decimal w/ 4 digits right of decimal pt) */
+ PT_APPTIME = 7, /* Application time */
+ PT_ERROR = 10, /* 32-bit error value */
+ PT_BOOLEAN = 11, /* 16-bit boolean (non-zero true, */
+ // Use PT_BOOLEAN_DESKTOP to be specific instead of using PT_BOOLEAN which is mapped to 2 in addrmapi.h
+ PT_BOOLEAN_DESKTOP = 11, /* 16-bit boolean (non-zero true) */
+ PT_OBJECT = 13, /* Embedded object in a property */
+ PT_I8 = 20, /* 8-byte signed integer */
+ PT_STRING8 = 30, /* Null terminated 8-bit character string */
+ PT_UNICODE = 31, /* Null terminated Unicode string */
+ PT_SYSTIME = 64, /* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
+ PT_CLSID = 72, /* OLE GUID */
+ PT_BINARY = 258, /* Uninterpreted (counted byte array) */
+
+ PT_TSTRING = PT_UNICODE
+ };
+
+ public enum PropTags : uint {
+ PR_ERROR = 10,
+
+ // Common non-transmittable
+ PR_ENTRYID = PT.PT_BINARY | 0x0FFF << 16,
+ PR_OBJECT_TYPE = PT.PT_LONG | 0x0FFE << 16,
+ PR_ICON = PT.PT_BINARY | 0x0FFD << 16,
+ PR_MINI_ICON = PT.PT_BINARY | 0x0FFC << 16,
+ PR_STORE_ENTRYID = PT.PT_BINARY | 0x0FFB << 16,
+ PR_STORE_RECORD_KEY = PT.PT_BINARY | 0x0FFA << 16,
+ PR_RECORD_KEY = PT.PT_BINARY | 0x0FF9 << 16,
+ PR_MAPPING_SIGNATURE = PT.PT_BINARY | 0x0FF8 << 16,
+ PR_ACCESS_LEVEL = PT.PT_LONG | 0x0FF7 << 16,
+ PR_INSTANCE_KEY = PT.PT_BINARY | 0x0FF6 << 16,
+ PR_ROW_TYPE = PT.PT_LONG | 0x0FF5 << 16,
+ PR_ACCESS = PT.PT_LONG | 0x0FF4 << 16,
+
+ // Common transmittable
+ PR_ROWID = PT.PT_LONG | 0x3000 << 16,
+ PR_DISPLAY_NAME = PT.PT_TSTRING | 0x3001 << 16,
+ PR_DISPLAY_NAME_W = PT.PT_UNICODE | 0x3001 << 16,
+ PR_DISPLAY_NAME_A = PT.PT_STRING8 | 0x3001 << 16,
+ PR_ADDRTYPE = PT.PT_TSTRING | 0x3002 << 16,
+ PR_ADDRTYPE_W = PT.PT_UNICODE | 0x3002 << 16,
+ PR_ADDRTYPE_A = PT.PT_STRING8 | 0x3002 << 16,
+ PR_EMAIL_ADDRESS = PT.PT_TSTRING | 0x3003 << 16,
+ PR_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x3003 << 16,
+ PR_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x3003 << 16,
+ PR_COMMENT = PT.PT_TSTRING | 0x3004 << 16,
+ PR_COMMENT_W = PT.PT_UNICODE | 0x3004 << 16,
+ PR_COMMENT_A = PT.PT_STRING8 | 0x3004 << 16,
+ PR_DEPTH = PT.PT_LONG | 0x3005 << 16,
+ PR_PROVIDER_DISPLAY = PT.PT_TSTRING | 0x3006 << 16,
+ PR_PROVIDER_DISPLAY_W = PT.PT_UNICODE | 0x3006 << 16,
+ PR_PROVIDER_DISPLAY_A = PT.PT_STRING8 | 0x3006 << 16,
+ PR_CREATION_TIME = PT.PT_SYSTIME | 0x3007 << 16,
+ PR_LAST_MODIFICATION_TIME = PT.PT_SYSTIME | 0x3008 << 16,
+ PR_RESOURCE_FLAGS = PT.PT_LONG | 0x3009 << 16,
+ PR_PROVIDER_DLL_NAME = PT.PT_TSTRING | 0x300A << 16,
+ PR_PROVIDER_DLL_NAME_W = PT.PT_UNICODE | 0x300A << 16,
+ PR_PROVIDER_DLL_NAME_A = PT.PT_STRING8 | 0x300A << 16,
+ PR_SEARCH_KEY = PT.PT_BINARY | 0x300B << 16,
+ PR_PROVIDER_UID = PT.PT_BINARY | 0x300C << 16,
+ PR_PROVIDER_ORDINAL = PT.PT_LONG | 0x300D << 16,
+
+ // Message store specific
+ PR_DEFAULT_STORE = PT.PT_BOOLEAN | 0x3400 << 16,
+ PR_STORE_SUPPORT_MASK = PT.PT_LONG | 0x340D << 16,
+ PR_STORE_STATE = PT.PT_LONG | 0x340E << 16,
+
+ PR_IPM_SUBTREE_SEARCH_KEY = PT.PT_BINARY | 0x3410 << 16,
+ PR_IPM_OUTBOX_SEARCH_KEY = PT.PT_BINARY | 0x3411 << 16,
+ PR_IPM_WASTEBASKET_SEARCH_KEY = PT.PT_BINARY | 0x3412 << 16,
+ PR_IPM_SENTMAIL_SEARCH_KEY = PT.PT_BINARY | 0x3413 << 16,
+ PR_MDB_PROVIDER = PT.PT_BINARY | 0x3414 << 16,
+ PR_RECEIVE_FOLDER_SETTINGS = PT.PT_OBJECT | 0x3415 << 16,
+
+ PR_VALID_FOLDER_MASK = PT.PT_LONG | 0x35DF << 16,
+ PR_IPM_SUBTREE_ENTRYID = PT.PT_BINARY | 0x35E0 << 16,
+
+ PR_IPM_OUTBOX_ENTRYID = PT.PT_BINARY | 0x35E2 << 16,
+ PR_IPM_WASTEBASKET_ENTRYID = PT.PT_BINARY | 0x35E3 << 16,
+ PR_IPM_SENTMAIL_ENTRYID = PT.PT_BINARY | 0x35E4 << 16,
+ PR_VIEWS_ENTRYID = PT.PT_BINARY | 0x35E5 << 16,
+ PR_COMMON_VIEWS_ENTRYID = PT.PT_BINARY | 0x35E6 << 16,
+ PR_FINDER_ENTRYID = PT.PT_BINARY | 0x35E7 << 16,
+ PR_ATTACH_CONTENT_ID = PT.PT_TSTRING | (0x3712 << 16),
+ PR_ATTACH_CONTENT_ID_A = PT.PT_STRING8 | (0x3712 << 16),
+ PR_ATTACH_CONTENT_ID_W = PT.PT_TSTRING | (0x3712 << 16),
+ PR_ATTACH_CONTENT_LOCATION = PT.PT_TSTRING | (0x3713 << 16),
+ PR_ATTACH_CONTENT_LOCATION_A = PT.PT_STRING8 | (0x3713 << 16),
+ PR_ATTACH_CONTENT_LOCATION_W = PT.PT_TSTRING | (0x3713 << 16),
+
+ // Message non-transmittable properties
+ PR_CURRENT_VERSION = PT.PT_I8 | 0x0E00 << 16,
+ PR_DELETE_AFTER_SUBMIT = PT.PT_BOOLEAN | 0x0E01 << 16,
+ PR_DISPLAY_BCC = PT.PT_TSTRING | 0x0E02 << 16,
+ PR_DISPLAY_BCC_W = PT.PT_UNICODE | 0x0E02 << 16,
+ PR_DISPLAY_BCC_A = PT.PT_STRING8 | 0x0E02 << 16,
+ PR_DISPLAY_CC = PT.PT_TSTRING | 0x0E03 << 16,
+ PR_DISPLAY_CC_W = PT.PT_UNICODE | 0x0E03 << 16,
+ PR_DISPLAY_CC_A = PT.PT_STRING8 | 0x0E03 << 16,
+ PR_DISPLAY_TO = PT.PT_TSTRING | 0x0E04 << 16,
+ PR_DISPLAY_TO_W = PT.PT_UNICODE | 0x0E04 << 16,
+ PR_DISPLAY_TO_A = PT.PT_STRING8 | 0x0E04 << 16,
+ PR_PARENT_DISPLAY = PT.PT_TSTRING | 0x0E05 << 16,
+ PR_PARENT_DISPLAY_W = PT.PT_UNICODE | 0x0E05 << 16,
+ PR_PARENT_DISPLAY_A = PT.PT_STRING8 | 0x0E05 << 16,
+ PR_MESSAGE_DELIVERY_TIME = PT.PT_SYSTIME | 0x0E06 << 16,
+ PR_MESSAGE_FLAGS = PT.PT_LONG | 0x0E07 << 16,
+ PR_MESSAGE_SIZE = PT.PT_LONG | 0x0E08 << 16,
+ PR_PARENT_ENTRYID = PT.PT_BINARY | 0x0E09 << 16,
+ PR_SENTMAIL_ENTRYID = PT.PT_BINARY | 0x0E0A << 16,
+ PR_CORRELATE = PT.PT_BOOLEAN | 0x0E0C << 16,
+ PR_CORRELATE_MTSID = PT.PT_BINARY | 0x0E0D << 16,
+ PR_DISCRETE_VALUES = PT.PT_BOOLEAN | 0x0E0E << 16,
+ PR_RESPONSIBILITY = PT.PT_BOOLEAN | 0x0E0F << 16,
+ PR_SPOOLER_STATUS = PT.PT_LONG | 0x0E10 << 16,
+ PR_TRANSPORT_STATUS = PT.PT_LONG | 0x0E11 << 16,
+ PR_MESSAGE_RECIPIENTS = PT.PT_OBJECT | 0x0E12 << 16,
+ PR_MESSAGE_ATTACHMENTS = PT.PT_OBJECT | 0x0E13 << 16,
+ PR_SUBMIT_FLAGS = PT.PT_LONG | 0x0E14 << 16,
+ PR_RECIPIENT_STATUS = PT.PT_LONG | 0x0E15 << 16,
+ PR_TRANSPORT_KEY = PT.PT_LONG | 0x0E16 << 16,
+ PR_MSG_STATUS = PT.PT_LONG | 0x0E17 << 16,
+ PR_MESSAGE_DOWNLOAD_TIME = PT.PT_LONG | 0x0E18 << 16,
+ PR_CREATION_VERSION = PT.PT_I8 | 0x0E19 << 16,
+ PR_MODIFY_VERSION = PT.PT_I8 | 0x0E1A << 16,
+ PR_HASATTACH = PT.PT_BOOLEAN | 0x0E1B << 16,
+ PR_BODY_CRC = PT.PT_LONG | 0x0E1C << 16,
+ PR_NORMALIZED_SUBJECT = PT.PT_TSTRING | 0x0E1D << 16,
+ PR_NORMALIZED_SUBJECT_W = PT.PT_UNICODE | 0x0E1D << 16,
+ PR_NORMALIZED_SUBJECT_A = PT.PT_STRING8 | 0x0E1D << 16,
+ PR_RTF_IN_SYNC = PT.PT_BOOLEAN | 0x0E1F << 16,
+ PR_ATTACH_SIZE = PT.PT_LONG | 0x0E20 << 16,
+ PR_ATTACH_NUM = PT.PT_LONG | 0x0E21 << 16,
+ PR_PREPROCESS = PT.PT_BOOLEAN | 0x0E22 << 16,
+
+ // Message recipient properties
+ PR_CONTENT_INTEGRITY_CHECK = PT.PT_BINARY | 0x0C00 << 16,
+ PR_EXPLICIT_CONVERSION = PT.PT_LONG | 0x0C01 << 16,
+ PR_IPM_RETURN_REQUESTED = PT.PT_BOOLEAN | 0x0C02 << 16,
+ PR_MESSAGE_TOKEN = PT.PT_BINARY | 0x0C03 << 16,
+ PR_NDR_REASON_CODE = PT.PT_LONG | 0x0C04 << 16,
+ PR_NDR_DIAG_CODE = PT.PT_LONG | 0x0C05 << 16,
+ PR_NON_RECEIPT_NOTIFICATION_REQUESTED = PT.PT_BOOLEAN | 0x0C06 << 16,
+ PR_DELIVERY_POINT = PT.PT_LONG | 0x0C07 << 16,
+
+ PR_ORIGINATOR_NON_DELIVERY_REPORT_REQUESTED = PT.PT_BOOLEAN | 0x0C08 << 16,
+ PR_ORIGINATOR_REQUESTED_ALTERNATE_RECIPIENT = PT.PT_BINARY | 0x0C09 << 16,
+ PR_PHYSICAL_DELIVERY_BUREAU_FAX_DELIVERY = PT.PT_BOOLEAN | 0x0C0A << 16,
+ PR_PHYSICAL_DELIVERY_MODE = PT.PT_LONG | 0x0C0B << 16,
+ PR_PHYSICAL_DELIVERY_REPORT_REQUEST = PT.PT_LONG | 0x0C0C << 16,
+ PR_PHYSICAL_FORWARDING_ADDRESS = PT.PT_BINARY | 0x0C0D << 16,
+ PR_PHYSICAL_FORWARDING_ADDRESS_REQUESTED = PT.PT_BOOLEAN | 0x0C0E << 16,
+ PR_PHYSICAL_FORWARDING_PROHIBITED = PT.PT_BOOLEAN | 0x0C0F << 16,
+ PR_PHYSICAL_RENDITION_ATTRIBUTES = PT.PT_BINARY | 0x0C10 << 16,
+ PR_PROOF_OF_DELIVERY = PT.PT_BINARY | 0x0C11 << 16,
+ PR_PROOF_OF_DELIVERY_REQUESTED = PT.PT_BOOLEAN | 0x0C12 << 16,
+ PR_RECIPIENT_CERTIFICATE = PT.PT_BINARY | 0x0C13 << 16,
+ PR_RECIPIENT_NUMBER_FOR_ADVICE = PT.PT_TSTRING | 0x0C14 << 16,
+ PR_RECIPIENT_NUMBER_FOR_ADVICE_W = PT.PT_UNICODE | 0x0C14 << 16,
+ PR_RECIPIENT_NUMBER_FOR_ADVICE_A = PT.PT_STRING8 | 0x0C14 << 16,
+ PR_RECIPIENT_TYPE = PT.PT_LONG | 0x0C15 << 16,
+ PR_REGISTERED_MAIL_TYPE = PT.PT_LONG | 0x0C16 << 16,
+ PR_REPLY_REQUESTED = PT.PT_BOOLEAN | 0x0C17 << 16,
+ //PR_REQUESTED_DELIVERY_METHOD = PT.PT_LONG | 0x0C18 << 16,
+ PR_SENDER_ENTRYID = PT.PT_BINARY | 0x0C19 << 16,
+ PR_SENDER_NAME = PT.PT_TSTRING | 0x0C1A << 16,
+ PR_SENDER_NAME_W = PT.PT_UNICODE | 0x0C1A << 16,
+ PR_SENDER_NAME_A = PT.PT_STRING8 | 0x0C1A << 16,
+ PR_SUPPLEMENTARY_INFO = PT.PT_TSTRING | 0x0C1B << 16,
+ PR_SUPPLEMENTARY_INFO_W = PT.PT_UNICODE | 0x0C1B << 16,
+ PR_SUPPLEMENTARY_INFO_A = PT.PT_STRING8 | 0x0C1B << 16,
+ PR_TYPE_OF_MTS_USER = PT.PT_LONG | 0x0C1C << 16,
+ PR_SENDER_SEARCH_KEY = PT.PT_BINARY | 0x0C1D << 16,
+ PR_SENDER_ADDRTYPE = PT.PT_TSTRING | 0x0C1E << 16,
+ PR_SENDER_ADDRTYPE_W = PT.PT_UNICODE | 0x0C1E << 16,
+ PR_SENDER_ADDRTYPE_A = PT.PT_STRING8 | 0x0C1E << 16,
+ PR_SENDER_EMAIL_ADDRESS = PT.PT_TSTRING | 0x0C1F << 16,
+ PR_SENDER_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x0C1F << 16,
+ PR_SENDER_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x0C1F << 16,
+
+ // Message envelope properties
+ PR_ACKNOWLEDGEMENT_MODE = PT.PT_LONG | 0x0001 << 16,
+ PR_ALTERNATE_RECIPIENT_ALLOWED = PT.PT_BOOLEAN | 0x0002 << 16,
+ PR_AUTHORIZING_USERS = PT.PT_BINARY | 0x0003 << 16,
+ PR_AUTO_FORWARD_COMMENT = PT.PT_TSTRING | 0x0004 << 16,
+ PR_AUTO_FORWARD_COMMENT_W = PT.PT_UNICODE | 0x0004 << 16,
+ PR_AUTO_FORWARD_COMMENT_A = PT.PT_STRING8 | 0x0004 << 16,
+ PR_AUTO_FORWARDED = PT.PT_BOOLEAN | 0x0005 << 16,
+ PR_CONTENT_CONFIDENTIALITY_ALGORITHM_ID = PT.PT_BINARY | 0x0006 << 16,
+ PR_CONTENT_CORRELATOR = PT.PT_BINARY | 0x0007 << 16,
+ PR_CONTENT_IDENTIFIER = PT.PT_TSTRING | 0x0008 << 16,
+ PR_CONTENT_IDENTIFIER_W = PT.PT_UNICODE | 0x0008 << 16,
+ PR_CONTENT_IDENTIFIER_A = PT.PT_STRING8 | 0x0008 << 16,
+ PR_CONTENT_LENGTH = PT.PT_LONG | 0x0009 << 16,
+ PR_CONTENT_RETURN_REQUESTED = PT.PT_BOOLEAN | 0x000A << 16,
+
+ // Message envelope properties
+ PR_CONVERSATION_KEY = PT.PT_BINARY | 0x000B << 16,
+
+ PR_CONVERSION_EITS = PT.PT_BINARY | 0x000C << 16,
+ PR_CONVERSION_WITH_LOSS_PROHIBITED = PT.PT_BOOLEAN | 0x000D << 16,
+ PR_CONVERTED_EITS = PT.PT_BINARY | 0x000E << 16,
+ PR_DEFERRED_DELIVERY_TIME = PT.PT_SYSTIME | 0x000F << 16,
+ PR_DELIVER_TIME = PT.PT_SYSTIME | 0x0010 << 16,
+ PR_DISCARD_REASON = PT.PT_LONG | 0x0011 << 16,
+ PR_DISCLOSURE_OF_RECIPIENTS = PT.PT_BOOLEAN | 0x0012 << 16,
+ PR_DL_EXPANSION_HISTORY = PT.PT_BINARY | 0x0013 << 16,
+ PR_DL_EXPANSION_PROHIBITED = PT.PT_BOOLEAN | 0x0014 << 16,
+ PR_EXPIRY_TIME = PT.PT_SYSTIME | 0x0015 << 16,
+ PR_IMPLICIT_CONVERSION_PROHIBITED = PT.PT_BOOLEAN | 0x0016 << 16,
+ PR_IMPORTANCE = PT.PT_LONG | 0x0017 << 16,
+ PR_IPM_ID = PT.PT_BINARY | 0x0018 << 16,
+ PR_LATEST_DELIVERY_TIME = PT.PT_SYSTIME | 0x0019 << 16,
+ PR_MESSAGE_CLASS = PT.PT_TSTRING | 0x001A << 16,
+ PR_MESSAGE_CLASS_W = PT.PT_UNICODE | 0x001A << 16,
+ PR_MESSAGE_CLASS_A = PT.PT_STRING8 | 0x001A << 16,
+ PR_MESSAGE_DELIVERY_ID = PT.PT_BINARY | 0x001B << 16,
+
+ PR_MESSAGE_SECURITY_LABEL = PT.PT_BINARY | 0x001E << 16,
+ PR_OBSOLETED_IPMS = PT.PT_BINARY | 0x001F << 16,
+ PR_ORIGINALLY_INTENDED_RECIPIENT_NAME = PT.PT_BINARY | 0x0020 << 16,
+ PR_ORIGINAL_EITS = PT.PT_BINARY | 0x0021 << 16,
+ PR_ORIGINATOR_CERTIFICATE = PT.PT_BINARY | 0x0022 << 16,
+ PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED = PT.PT_BOOLEAN | 0x0023 << 16,
+ PR_ORIGINATOR_RETURN_ADDRESS = PT.PT_BINARY | 0x0024 << 16,
+
+ PR_PARENT_KEY = PT.PT_BINARY | 0x0025 << 16,
+ PR_PRIORITY = PT.PT_LONG | 0x0026 << 16,
+
+ PR_ORIGIN_CHECK = PT.PT_BINARY | 0x0027 << 16,
+ PR_PROOF_OF_SUBMISSION_REQUESTED = PT.PT_BOOLEAN | 0x0028 << 16,
+ PR_READ_RECEIPT_REQUESTED = PT.PT_BOOLEAN | 0x0029 << 16,
+ PR_RECEIPT_TIME = PT.PT_SYSTIME | 0x002A << 16,
+ PR_RECIPIENT_REASSIGNMENT_PROHIBITED = PT.PT_BOOLEAN | 0x002B << 16,
+ PR_REDIRECTION_HISTORY = PT.PT_BINARY | 0x002C << 16,
+ PR_RELATED_IPMS = PT.PT_BINARY | 0x002D << 16,
+ PR_ORIGINAL_SENSITIVITY = PT.PT_LONG | 0x002E << 16,
+ PR_LANGUAGES = PT.PT_TSTRING | 0x002F << 16,
+ PR_LANGUAGES_W = PT.PT_UNICODE | 0x002F << 16,
+ PR_LANGUAGES_A = PT.PT_STRING8 | 0x002F << 16,
+ PR_REPLY_TIME = PT.PT_SYSTIME | 0x0030 << 16,
+ PR_REPORT_TAG = PT.PT_BINARY | 0x0031 << 16,
+ PR_REPORT_TIME = PT.PT_SYSTIME | 0x0032 << 16,
+ PR_RETURNED_IPM = PT.PT_BOOLEAN | 0x0033 << 16,
+ PR_SECURITY = PT.PT_LONG | 0x0034 << 16,
+ PR_INCOMPLETE_COPY = PT.PT_BOOLEAN | 0x0035 << 16,
+ PR_SENSITIVITY = PT.PT_LONG | 0x0036 << 16,
+ PR_SUBJECT = PT.PT_TSTRING | 0x0037 << 16,
+ PR_SUBJECT_W = PT.PT_UNICODE | 0x0037 << 16,
+ PR_SUBJECT_A = PT.PT_STRING8 | 0x0037 << 16,
+ PR_SUBJECT_IPM = PT.PT_BINARY | 0x0038 << 16,
+ PR_CLIENT_SUBMIT_TIME = PT.PT_SYSTIME | 0x0039 << 16,
+ PR_REPORT_NAME = PT.PT_TSTRING | 0x003A << 16,
+ PR_REPORT_NAME_W = PT.PT_UNICODE | 0x003A << 16,
+ PR_REPORT_NAME_A = PT.PT_STRING8 | 0x003A << 16,
+ PR_SENT_REPRESENTING_SEARCH_KEY = PT.PT_BINARY | 0x003B << 16,
+ PR_X400_CONTENT_TYPE = PT.PT_BINARY | 0x003C << 16,
+ PR_SUBJECT_PREFIX = PT.PT_TSTRING | 0x003D << 16,
+ PR_SUBJECT_PREFIX_W = PT.PT_UNICODE | 0x003D << 16,
+ PR_SUBJECT_PREFIX_A = PT.PT_STRING8 | 0x003D << 16,
+ PR_NON_RECEIPT_REASON = PT.PT_LONG | 0x003E << 16,
+ PR_RECEIVED_BY_ENTRYID = PT.PT_BINARY | 0x003F << 16,
+ PR_RECEIVED_BY_NAME = PT.PT_TSTRING | 0x0040 << 16,
+ PR_RECEIVED_BY_NAME_W = PT.PT_UNICODE | 0x0040 << 16,
+ PR_RECEIVED_BY_NAME_A = PT.PT_STRING8 | 0x0040 << 16,
+ PR_SENT_REPRESENTING_ENTRYID = PT.PT_BINARY | 0x0041 << 16,
+ PR_SENT_REPRESENTING_NAME = PT.PT_TSTRING | 0x0042 << 16,
+ PR_SENT_REPRESENTING_NAME_W = PT.PT_UNICODE | 0x0042 << 16,
+ PR_SENT_REPRESENTING_NAME_A = PT.PT_STRING8 | 0x0042 << 16,
+ PR_RCVD_REPRESENTING_ENTRYID = PT.PT_BINARY | 0x0043 << 16,
+ PR_RCVD_REPRESENTING_NAME = PT.PT_TSTRING | 0x0044 << 16,
+ PR_RCVD_REPRESENTING_NAME_W = PT.PT_UNICODE | 0x0044 << 16,
+ PR_RCVD_REPRESENTING_NAME_A = PT.PT_STRING8 | 0x0044 << 16,
+ PR_REPORT_ENTRYID = PT.PT_BINARY | 0x0045 << 16,
+ PR_READ_RECEIPT_ENTRYID = PT.PT_BINARY | 0x0046 << 16,
+ PR_MESSAGE_SUBMISSION_ID = PT.PT_BINARY | 0x0047 << 16,
+ PR_PROVIDER_SUBMIT_TIME = PT.PT_SYSTIME | 0x0048 << 16,
+ PR_ORIGINAL_SUBJECT = PT.PT_TSTRING | 0x0049 << 16,
+ PR_ORIGINAL_SUBJECT_W = PT.PT_UNICODE | 0x0049 << 16,
+ PR_ORIGINAL_SUBJECT_A = PT.PT_STRING8 | 0x0049 << 16,
+ PR_DISC_VAL = PT.PT_BOOLEAN | 0x004A << 16,
+ PR_ORIG_MESSAGE_CLASS = PT.PT_TSTRING | 0x004B << 16,
+ PR_ORIG_MESSAGE_CLASS_W = PT.PT_UNICODE | 0x004B << 16,
+ PR_ORIG_MESSAGE_CLASS_A = PT.PT_STRING8 | 0x004B << 16,
+ PR_ORIGINAL_AUTHOR_ENTRYID = PT.PT_BINARY | 0x004C << 16,
+ PR_ORIGINAL_AUTHOR_NAME = PT.PT_TSTRING | 0x004D << 16,
+ PR_ORIGINAL_AUTHOR_NAME_W = PT.PT_UNICODE | 0x004D << 16,
+ PR_ORIGINAL_AUTHOR_NAME_A = PT.PT_STRING8 | 0x004D << 16,
+ PR_ORIGINAL_SUBMIT_TIME = PT.PT_SYSTIME | 0x004E << 16,
+ PR_REPLY_RECIPIENT_ENTRIES = PT.PT_BINARY | 0x004F << 16,
+ PR_REPLY_RECIPIENT_NAMES = PT.PT_TSTRING | 0x0050 << 16,
+ PR_REPLY_RECIPIENT_NAMES_W = PT.PT_UNICODE | 0x0050 << 16,
+ PR_REPLY_RECIPIENT_NAMES_A = PT.PT_STRING8 | 0x0050 << 16,
+
+ PR_RECEIVED_BY_SEARCH_KEY = PT.PT_BINARY | 0x0051 << 16,
+ PR_RCVD_REPRESENTING_SEARCH_KEY = PT.PT_BINARY | 0x0052 << 16,
+ PR_READ_RECEIPT_SEARCH_KEY = PT.PT_BINARY | 0x0053 << 16,
+ PR_REPORT_SEARCH_KEY = PT.PT_BINARY | 0x0054 << 16,
+ PR_ORIGINAL_DELIVERY_TIME = PT.PT_SYSTIME | 0x0055 << 16,
+ PR_ORIGINAL_AUTHOR_SEARCH_KEY = PT.PT_BINARY | 0x0056 << 16,
+
+ PR_MESSAGE_TO_ME = PT.PT_BOOLEAN | 0x0057 << 16,
+ PR_MESSAGE_CC_ME = PT.PT_BOOLEAN | 0x0058 << 16,
+ PR_MESSAGE_RECIP_ME = PT.PT_BOOLEAN | 0x0059 << 16,
+
+ PR_ORIGINAL_SENDER_NAME = PT.PT_TSTRING | 0x005A << 16,
+ PR_ORIGINAL_SENDER_NAME_W = PT.PT_UNICODE | 0x005A << 16,
+ PR_ORIGINAL_SENDER_NAME_A = PT.PT_STRING8 | 0x005A << 16,
+ PR_ORIGINAL_SENDER_ENTRYID = PT.PT_BINARY | 0x005B << 16,
+ PR_ORIGINAL_SENDER_SEARCH_KEY = PT.PT_BINARY | 0x005C << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_NAME = PT.PT_TSTRING | 0x005D << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_NAME_W = PT.PT_UNICODE | 0x005D << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_NAME_A = PT.PT_STRING8 | 0x005D << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_ENTRYID = PT.PT_BINARY | 0x005E << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_SEARCH_KEY = PT.PT_BINARY | 0x005F << 16,
+
+ PR_START_DATE = PT.PT_SYSTIME | 0x0060 << 16,
+ PR_END_DATE = PT.PT_SYSTIME | 0x0061 << 16,
+ PR_OWNER_APPT_ID = PT.PT_LONG | 0x0062 << 16,
+ //PR_RESPONSE_REQUESTED = PT.PT_BOOLEAN | 0x0063 << 16,
+
+ PR_SENT_REPRESENTING_ADDRTYPE = PT.PT_TSTRING | 0x0064 << 16,
+ PR_SENT_REPRESENTING_ADDRTYPE_W = PT.PT_UNICODE | 0x0064 << 16,
+ PR_SENT_REPRESENTING_ADDRTYPE_A = PT.PT_STRING8 | 0x0064 << 16,
+ PR_SENT_REPRESENTING_EMAIL_ADDRESS = PT.PT_TSTRING | 0x0065 << 16,
+ PR_SENT_REPRESENTING_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x0065 << 16,
+ PR_SENT_REPRESENTING_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x0065 << 16,
+
+ PR_ORIGINAL_SENDER_ADDRTYPE = PT.PT_TSTRING | 0x0066 << 16,
+ PR_ORIGINAL_SENDER_ADDRTYPE_W = PT.PT_UNICODE | 0x0066 << 16,
+ PR_ORIGINAL_SENDER_ADDRTYPE_A = PT.PT_STRING8 | 0x0066 << 16,
+ PR_ORIGINAL_SENDER_EMAIL_ADDRESS = PT.PT_TSTRING | 0x0067 << 16,
+ PR_ORIGINAL_SENDER_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x0067 << 16,
+ PR_ORIGINAL_SENDER_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x0067 << 16,
+
+ PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE = PT.PT_TSTRING | 0x0068 << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE_W = PT.PT_UNICODE | 0x0068 << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE_A = PT.PT_STRING8 | 0x0068 << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS = PT.PT_TSTRING | 0x0069 << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x0069 << 16,
+ PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x0069 << 16,
+
+ PR_CONVERSATION_TOPIC = PT.PT_TSTRING | 0x0070 << 16,
+ PR_CONVERSATION_TOPIC_W = PT.PT_UNICODE | 0x0070 << 16,
+ PR_CONVERSATION_TOPIC_A = PT.PT_STRING8 | 0x0070 << 16,
+ PR_CONVERSATION_INDEX = PT.PT_BINARY | 0x0071 << 16,
+
+ PR_ORIGINAL_DISPLAY_BCC = PT.PT_TSTRING | 0x0072 << 16,
+ PR_ORIGINAL_DISPLAY_BCC_W = PT.PT_UNICODE | 0x0072 << 16,
+ PR_ORIGINAL_DISPLAY_BCC_A = PT.PT_STRING8 | 0x0072 << 16,
+ PR_ORIGINAL_DISPLAY_CC = PT.PT_TSTRING | 0x0073 << 16,
+ PR_ORIGINAL_DISPLAY_CC_W = PT.PT_UNICODE | 0x0073 << 16,
+ PR_ORIGINAL_DISPLAY_CC_A = PT.PT_STRING8 | 0x0073 << 16,
+ PR_ORIGINAL_DISPLAY_TO = PT.PT_TSTRING | 0x0074 << 16,
+ PR_ORIGINAL_DISPLAY_TO_W = PT.PT_UNICODE | 0x0074 << 16,
+ PR_ORIGINAL_DISPLAY_TO_A = PT.PT_STRING8 | 0x0074 << 16,
+
+ PR_RECEIVED_BY_ADDRTYPE = PT.PT_TSTRING | 0x0075 << 16,
+ PR_RECEIVED_BY_ADDRTYPE_W = PT.PT_UNICODE | 0x0075 << 16,
+ PR_RECEIVED_BY_ADDRTYPE_A = PT.PT_STRING8 | 0x0075 << 16,
+ PR_RECEIVED_BY_EMAIL_ADDRESS = PT.PT_TSTRING | 0x0076 << 16,
+ PR_RECEIVED_BY_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x0076 << 16,
+ PR_RECEIVED_BY_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x0076 << 16,
+
+ PR_RCVD_REPRESENTING_ADDRTYPE = PT.PT_TSTRING | 0x0077 << 16,
+ PR_RCVD_REPRESENTING_ADDRTYPE_W = PT.PT_UNICODE | 0x0077 << 16,
+ PR_RCVD_REPRESENTING_ADDRTYPE_A = PT.PT_STRING8 | 0x0077 << 16,
+ PR_RCVD_REPRESENTING_EMAIL_ADDRESS = PT.PT_TSTRING | 0x0078 << 16,
+ PR_RCVD_REPRESENTING_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x0078 << 16,
+ PR_RCVD_REPRESENTING_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x0078 << 16,
+
+ PR_ORIGINAL_AUTHOR_ADDRTYPE = PT.PT_TSTRING | 0x0079 << 16,
+ PR_ORIGINAL_AUTHOR_ADDRTYPE_W = PT.PT_UNICODE | 0x0079 << 16,
+ PR_ORIGINAL_AUTHOR_ADDRTYPE_A = PT.PT_STRING8 | 0x0079 << 16,
+ PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS = PT.PT_TSTRING | 0x007A << 16,
+ PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x007A << 16,
+ PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x007A << 16,
+
+ PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE = PT.PT_TSTRING | 0x007B << 16,
+ PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE_W = PT.PT_UNICODE | 0x007B << 16,
+ PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE_A = PT.PT_STRING8 | 0x007B << 16,
+ PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS = PT.PT_TSTRING | 0x007C << 16,
+ PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS_W = PT.PT_UNICODE | 0x007C << 16,
+ PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS_A = PT.PT_STRING8 | 0x007C << 16,
+
+ PR_TRANSPORT_MESSAGE_HEADERS = PT.PT_TSTRING | 0x007D << 16,
+ PR_TRANSPORT_MESSAGE_HEADERS_W = PT.PT_UNICODE | 0x007D << 16,
+ PR_TRANSPORT_MESSAGE_HEADERS_A = PT.PT_STRING8 | 0x007D << 16,
+
+ PR_DELEGATION = PT.PT_BINARY | 0x007E << 16,
+
+ PR_TNEF_CORRELATION_KEY = PT.PT_BINARY | 0x007F << 16,
+
+ // Message content properties
+ PR_BODY = PT.PT_TSTRING | 0x1000 << 16,
+ PR_BODY_W = PT.PT_UNICODE | 0x1000 << 16,
+ PR_BODY_A = PT.PT_STRING8 | 0x1000 << 16,
+ PR_REPORT_TEXT = PT.PT_TSTRING | 0x1001 << 16,
+ PR_REPORT_TEXT_W = PT.PT_UNICODE | 0x1001 << 16,
+ PR_REPORT_TEXT_A = PT.PT_STRING8 | 0x1001 << 16,
+ PR_ORIGINATOR_AND_DL_EXPANSION_HISTORY = PT.PT_BINARY | 0x1002 << 16,
+ PR_REPORTING_DL_NAME = PT.PT_BINARY | 0x1003 << 16,
+ PR_REPORTING_MTA_CERTIFICATE = PT.PT_BINARY | 0x1004 << 16,
+ };
+
+ public class OutlookUtils {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OutlookUtils));
+ private const uint KEEP_OPEN_READONLY = 0x00000001;
+ private const uint KEEP_OPEN_READWRITE = 0x00000002;
+ private const uint FORCE_SAVE = 0x00000004;
+
+ #region MAPI Interface ID'S
+ // The Interface ID's are used to retrieve the specific MAPI Interfaces from the IUnknown Object
+ public const string IID_IMAPISession = "00020300-0000-0000-C000-000000000046";
+ public const string IID_IMAPIProp = "00020303-0000-0000-C000-000000000046";
+ public const string IID_IMAPITable = "00020301-0000-0000-C000-000000000046";
+ public const string IID_IMAPIMsgStore = "00020306-0000-0000-C000-000000000046";
+ public const string IID_IMAPIFolder = "0002030C-0000-0000-C000-000000000046";
+ public const string IID_IMAPISpoolerService = "0002031E-0000-0000-C000-000000000046";
+ public const string IID_IMAPIStatus = "0002031E-0000-0000-C000-000000000046";
+ public const string IID_IMessage = "00020307-0000-0000-C000-000000000046";
+ public const string IID_IAddrBook = "00020309-0000-0000-C000-000000000046";
+ public const string IID_IProfSect = "00020304-0000-0000-C000-000000000046";
+ public const string IID_IMAPIContainer = "0002030B-0000-0000-C000-000000000046";
+ public const string IID_IABContainer = "0002030D-0000-0000-C000-000000000046";
+ public const string IID_IMsgServiceAdmin = "0002031D-0000-0000-C000-000000000046";
+ public const string IID_IProfAdmin = "0002031C-0000-0000-C000-000000000046";
+ public const string IID_IMailUser = "0002030A-0000-0000-C000-000000000046";
+ public const string IID_IDistList = "0002030E-0000-0000-C000-000000000046";
+ public const string IID_IAttachment = "00020308-0000-0000-C000-000000000046";
+ public const string IID_IMAPIControl = "0002031B-0000-0000-C000-000000000046";
+ public const string IID_IMAPILogonRemote = "00020346-0000-0000-C000-000000000046";
+ public const string IID_IMAPIForm = "00020327-0000-0000-C000-000000000046";
+ #endregion
+
+ [ComVisible(false)]
+ [ComImport()]
+ [Guid(IID_IMAPIProp)]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IMessage : IMAPIProp {
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int GetAttachmentTable();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int OpenAttach();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int CreateAttach();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int DeleteAttach();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int GetRecipientTable();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int ModifyRecipients();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int SubmitMessage();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int SetReadFlag();
+ }
+ // [ComVisible(false)]
+ // [ComImport()]
+ // [Guid(IID_IMAPIFolder)]
+ // [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ // interface IMAPIFolder : IMAPIContainer {
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int CreateMessage(IntPtr interf, uint uFlags, [MarshalAs(UnmanagedType.Interface)] ref IMessage pMsg);
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int CopyMessages();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int CreateFolder();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int CopyFolder();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int DeleteFolder();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int SetReadFlags();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int GetMessageStatus();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int SetMessageStatus();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int SaveContentsSort();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int EmptyFolder();
+ // }
+ // [ComVisible(false)]
+ // [ComImport()]
+ // [Guid(IID_IMAPIContainer)]
+ // [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ // interface IMAPIContainer : IMAPIProp {
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int GetContentsTable(uint uFlags, [MarshalAs(UnmanagedType.Interface), Out] out outlook.Table tbl);
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int GetHierarchyTable();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int OpenEntry();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int SetSearchCriteria();
+ // [return: MarshalAs(UnmanagedType.I4)]
+ // [PreserveSig]
+ // int GetSearchCriteria();
+ // }
+
+ [ComVisible(false)]
+ [ComImport()]
+ [Guid(IID_IMAPIProp)]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IMAPIProp {
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int GetLastError();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int SaveChanges(
+ uint uFlags
+ );
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int GetProps();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int GetPropList();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int OpenProperty();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int SetProps(uint values, IntPtr propArray, IntPtr problems);
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int DeleteProps();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int CopyTo();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int CopyProps();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int GetNamesFromIDs();
+ [return: MarshalAs(UnmanagedType.I4)]
+ [PreserveSig]
+ int GetIDsFromNames();
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ private struct SPropValue {
+ [FieldOffset(0)]
+ public uint propTag;
+ [FieldOffset(4)]
+ public uint alignPad;
+ [FieldOffset(8)]
+ public IntPtr Value;
+ [FieldOffset(8)]
+ public long filler;
+ }
+
+ ///
+ /// Use MAPI32.DLL "HrGetOneProp" from managed code
+ ///
+ ///
+ ///
+ ///
+ public static string GetMAPIProperty(Attachment attachment, PropTags proptag) {
+ object mapiObject = attachment.MAPIOBJECT;
+ if (mapiObject == null) {
+ return "";
+ }
+
+ string sProperty = "";
+ IntPtr pPropValue = IntPtr.Zero;
+
+ IntPtr IUnknown = IntPtr.Zero;
+ IntPtr IMAPIProperty = IntPtr.Zero;
+
+ try {
+ MAPIInitialize(IntPtr.Zero);
+ IUnknown = Marshal.GetIUnknownForObject(mapiObject);
+ Guid guidMAPIProp = new Guid(IID_IMAPIProp);
+ if (Marshal.QueryInterface(IUnknown, ref guidMAPIProp, out IMAPIProperty) != 0) {
+ return "";
+ }
+ try {
+ HrGetOneProp(IMAPIProperty, (uint)proptag, out pPropValue);
+ if (pPropValue == IntPtr.Zero) {
+ return "";
+ }
+ SPropValue propValue = (SPropValue)Marshal.PtrToStructure(pPropValue, typeof(SPropValue));
+ sProperty = Marshal.PtrToStringUni(propValue.Value);
+ } catch (System.Exception ex) {
+ throw ex;
+ }
+ } finally {
+ if (pPropValue != IntPtr.Zero) {
+ MAPIFreeBuffer(pPropValue);
+ }
+ if (IMAPIProperty != IntPtr.Zero) {
+ Marshal.Release(IMAPIProperty);
+ }
+ if (IUnknown != IntPtr.Zero) {
+ Marshal.Release(IUnknown);
+ }
+ MAPIUninitialize();
+ }
+ return sProperty;
+ }
+
+ ///
+ /// Tries to save the changes we just made
+ ///
+ ///
+ ///
+ public static bool SaveChanges(MailItem mailItem) {
+ // Pointer to IUnknown Interface
+ IntPtr IUnknown = IntPtr.Zero;
+ // Pointer to IMAPIProp Interface
+ IntPtr IMAPIProp = IntPtr.Zero;
+ // if we have no MAPIObject everything is senseless...
+ if (mailItem == null) {
+ return false;
+ }
+
+ try {
+ // We can pass NULL here as parameter, so we do it.
+ MAPIInitialize(IntPtr.Zero);
+ // retrive the IUnknon Interface from our MAPIObject comming from Outlook.
+ IUnknown = Marshal.GetIUnknownForObject(mailItem.MAPIOBJECT);
+
+ // create a Guid that we pass to retreive the IMAPIProp Interface.
+ Guid guidIMAPIProp = new Guid(IID_IMAPIProp);
+
+ // try to retrieve the IMAPIProp interface from IMessage Interface, everything else is sensless.
+ if (Marshal.QueryInterface(IUnknown, ref guidIMAPIProp, out IMAPIProp) != 0) {
+ return false;
+ }
+ IMAPIProp mapiProp = (IMAPIProp)Marshal.GetTypedObjectForIUnknown(IUnknown, typeof(IMAPIProp));
+ return (mapiProp.SaveChanges(KEEP_OPEN_READWRITE) == 0);
+ } catch (Exception ex) {
+ LOG.Error(ex);
+ return false;
+ } finally {
+ // cleanup all references to COM Objects
+ if (IMAPIProp != IntPtr.Zero) Marshal.Release(IMAPIProp);
+ //if (IMessage != IntPtr.Zero) Marshal.Release(IMessage);
+ if (IUnknown != IntPtr.Zero) Marshal.Release(IUnknown);
+ }
+ }
+
+ ///
+ /// Uses the IMAPIPROP.SetProps to set the content ID
+ ///
+ ///
+ ///
+ public static void SetContentID(Attachment attachment, string contentId) {
+ // Pointer to IUnknown Interface
+ IntPtr IUnknown = IntPtr.Zero;
+ // Pointer to IMAPIProp Interface
+ IntPtr IMAPIProp = IntPtr.Zero;
+ // A pointer that points to the SPropValue structure
+ IntPtr ptrPropValue = IntPtr.Zero;
+ // Structure that will hold the Property Value
+ SPropValue propValue;
+ // if we have no MAPIObject everything is senseless...
+ if (attachment == null) {
+ return;
+ }
+
+ try {
+ // We can pass NULL here as parameter, so we do it.
+ MAPIInitialize(IntPtr.Zero);
+
+ // retrive the IUnknon Interface from our MAPIObject comming from Outlook.
+ IUnknown = Marshal.GetIUnknownForObject(attachment.MAPIOBJECT);
+ IMAPIProp mapiProp = (IMAPIProp)Marshal.GetTypedObjectForIUnknown(IUnknown, typeof(IMAPIProp));
+
+ // Create structure
+ propValue = new SPropValue();
+ propValue.propTag = (uint)PropTags.PR_ATTACH_CONTENT_ID;
+ //propValue.propTag = 0x3712001E;
+ // Create Ansi string
+ propValue.Value = Marshal.StringToHGlobalUni(contentId);
+
+ // Create unmanaged memory for structure
+ ptrPropValue = Marshal.AllocHGlobal(Marshal.SizeOf(propValue));
+ // Copy structure to unmanged memory
+ Marshal.StructureToPtr(propValue, ptrPropValue, false);
+ mapiProp.SetProps(1, ptrPropValue, IntPtr.Zero);
+
+ propValue.propTag = (uint)PropTags.PR_ATTACH_CONTENT_LOCATION;
+ // Copy structure to unmanged memory
+ Marshal.StructureToPtr(propValue, ptrPropValue, false);
+ mapiProp.SetProps(1, ptrPropValue, IntPtr.Zero);
+
+
+ // Free string
+ Marshal.FreeHGlobal(propValue.Value);
+ mapiProp.SaveChanges(KEEP_OPEN_READWRITE);
+ } catch (Exception ex) {
+ LOG.Error(ex);
+ } finally {
+ // Free used Memory structures
+ if (ptrPropValue != IntPtr.Zero) Marshal.FreeHGlobal(ptrPropValue);
+ // cleanup all references to COM Objects
+ if (IMAPIProp != IntPtr.Zero) Marshal.Release(IMAPIProp);
+ //if (IMessage != IntPtr.Zero) Marshal.Release(IMessage);
+ if (IUnknown != IntPtr.Zero) Marshal.Release(IUnknown);
+ }
+ }
+
+ ///
+ /// Use MAPI32.DLL "HrSetOneProp" from managed code
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool SetMAPIProperty(Attachment attachment, PropTags proptag, string propertyValue) {
+ // Pointer to IUnknown Interface
+ IntPtr IUnknown = IntPtr.Zero;
+ // Pointer to IMAPIProp Interface
+ IntPtr IMAPIProp = IntPtr.Zero;
+ // Structure that will hold the Property Value
+ SPropValue propValue;
+ // A pointer that points to the SPropValue structure
+ IntPtr ptrPropValue = IntPtr.Zero;
+ object mapiObject = attachment.MAPIOBJECT;
+ // if we have no MAPIObject everything is senseless...
+ if (mapiObject == null) {
+ return false;
+ }
+
+ try {
+ // We can pass NULL here as parameter, so we do it.
+ MAPIInitialize(IntPtr.Zero);
+
+ // retrive the IUnknon Interface from our MAPIObject comming from Outlook.
+ IUnknown = Marshal.GetIUnknownForObject(mapiObject);
+
+ // create a Guid that we pass to retreive the IMAPIProp Interface.
+ Guid guidIMAPIProp = new Guid(IID_IMAPIProp);
+
+ // try to retrieve the IMAPIProp interface from IMessage Interface, everything else is sensless.
+ if (Marshal.QueryInterface(IUnknown, ref guidIMAPIProp, out IMAPIProp) != 0) {
+ return false;
+ }
+
+ // double check, if we wave no pointer, exit...
+ if (IMAPIProp == IntPtr.Zero) {
+ return false;
+ }
+
+ // Create structure
+ propValue = new SPropValue();
+ propValue.propTag = (uint)proptag;
+ // Create Ansi string
+ propValue.Value = Marshal.StringToHGlobalUni(propertyValue);
+
+ // Create unmanaged memory for structure
+ ptrPropValue = Marshal.AllocHGlobal(Marshal.SizeOf(propValue));
+ // Copy structure to unmanged memory
+ Marshal.StructureToPtr(propValue, ptrPropValue, false);
+
+ // Set the property
+ HrSetOneProp(IMAPIProp, ptrPropValue);
+
+ // Free string
+ Marshal.FreeHGlobal(propValue.Value);
+ IMAPIProp mapiProp = (IMAPIProp)Marshal.GetTypedObjectForIUnknown(IUnknown, typeof(IMAPIProp));
+ return mapiProp.SaveChanges(4) == 0;
+ } catch (System.Exception ex) {
+ LOG.Error(ex);
+ return false;
+ } finally {
+ // Free used Memory structures
+ if (ptrPropValue != IntPtr.Zero) Marshal.FreeHGlobal(ptrPropValue);
+ // cleanup all references to COM Objects
+ if (IMAPIProp != IntPtr.Zero) Marshal.Release(IMAPIProp);
+ //if (IMessage != IntPtr.Zero) Marshal.Release(IMessage);
+ if (IUnknown != IntPtr.Zero) Marshal.Release(IUnknown);
+ MAPIUninitialize();
+ }
+ }
+
+ #region MAPI DLL Imports
+
+ [DllImport("MAPI32.DLL", CharSet = CharSet.Ansi, EntryPoint = "HrGetOneProp@12")]
+ private static extern void HrGetOneProp(IntPtr pmp, uint ulPropTag, out IntPtr ppProp);
+
+ [DllImport("MAPI32.DLL", CharSet = CharSet.Ansi, EntryPoint = "HrSetOneProp@8")]
+ private static extern void HrSetOneProp(IntPtr pmp, IntPtr pprop);
+
+ [DllImport("MAPI32.DLL", CharSet = CharSet.Ansi, EntryPoint = "MAPIFreeBuffer@4")]
+ private static extern void MAPIFreeBuffer(IntPtr lpBuffer);
+
+ [DllImport("MAPI32.DLL", CharSet = CharSet.Ansi)]
+ private static extern int MAPIInitialize(IntPtr lpMapiInit);
+
+ [DllImport("MAPI32.DLL", CharSet = CharSet.Ansi)]
+ private static extern void MAPIUninitialize();
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/GreenshotInterop/OfficeInterop/PowerpointInterop.cs b/GreenshotInterop/OfficeInterop/PowerpointInterop.cs
new file mode 100644
index 000000000..a01a67585
--- /dev/null
+++ b/GreenshotInterop/OfficeInterop/PowerpointInterop.cs
@@ -0,0 +1,125 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Runtime.Remoting.Messaging;
+using Greenshot.Interop;
+
+namespace Greenshot.Interop.Office {
+ // See http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.application_members.aspx
+ [ComProgId("Powerpoint.Application")]
+ public interface IPowerpointApplication : Common {
+ IPresentation ActivePresentation { get; }
+ IPresentations Presentations { get; }
+ bool Visible { get; set; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.slides_members.aspx
+ public interface ISlides : Common {
+ int Count { get; }
+ ISlide Add(int Index, int layout);
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.presentation_members.aspx
+ public interface IPresentation : Common {
+ string Name { get; }
+ ISlides Slides { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.presentations_members.aspx
+ public interface IPresentations : Common, Collection {
+ IPresentation Add(MsoTriState WithWindow);
+ IPresentation item(int index);
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.slide_members.aspx
+ public interface ISlide : Common {
+ IShapes Shapes { get; }
+ void Select();
+ int SlideNumber { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.shapes_members.aspx
+ public interface IShapes : Common, IEnumerable {
+ int Count { get; }
+ IShape item(int index);
+ IShape AddPicture(string FileName, MsoTriState LinkToFile, MsoTriState SaveWithDocument, float Left, float Top, float Width, float Height);
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.shape_members.aspx
+ public interface IShape : Common {
+ float Left { get; set; }
+ float Top { get; set; }
+ float Width { get; set; }
+ float Height { get; set; }
+ ITextFrame TextFrame { get; }
+ void ScaleWidth(float Factor, MsoTriState RelativeToOriginalSize, MsoScaleFrom fScale);
+ void ScaleHeight(float Factor, MsoTriState RelativeToOriginalSize, MsoScaleFrom fScale);
+ }
+
+ public interface ITextFrame : Common {
+ ITextRange TextRange { get; }
+ }
+ public interface ITextRange : Common {
+ string Text { get; set; }
+ }
+
+ public enum PPSlideLayout : int {
+ ppLayoutMixed = -2,
+ ppLayoutTitle = 1,
+ ppLayoutText = 2,
+ ppLayoutTwoColumnText = 3,
+ ppLayoutTable = 4,
+ ppLayoutTextAndChart = 5,
+ ppLayoutChartAndText = 6,
+ ppLayoutOrgchart = 7,
+ ppLayoutChart = 8,
+ ppLayoutTextAndClipart = 9,
+ ppLayoutClipartAndText = 10,
+ ppLayoutTitleOnly = 11,
+ ppLayoutBlank = 12,
+ ppLayoutTextAndObject = 13,
+ ppLayoutObjectAndText = 14,
+ ppLayoutLargeObject = 15,
+ ppLayoutObject = 16,
+ ppLayoutTextAndMediaClip = 17,
+ ppLayoutMediaClipAndText = 18,
+ ppLayoutObjectOverText = 19,
+ ppLayoutTextOverObject = 20,
+ ppLayoutTextAndTwoObjects = 21,
+ ppLayoutTwoObjectsAndText = 22,
+ ppLayoutTwoObjectsOverText = 23,
+ ppLayoutFourObjects = 24,
+ ppLayoutVerticalText = 25,
+ ppLayoutClipArtAndVerticalText = 26,
+ ppLayoutVerticalTitleAndText = 27,
+ ppLayoutVerticalTitleAndTextOverChart = 28,
+ ppLayoutTwoObjects = 29,
+ ppLayoutObjectAndTwoObjects = 30,
+ ppLayoutTwoObjectsAndObject = 31,
+ ppLayoutCustom = 32,
+ ppLayoutSectionHeader = 33,
+ ppLayoutComparison = 34,
+ ppLayoutContentWithCaption = 35,
+ ppLayoutPictureWithCaption = 36
+ }
+}
diff --git a/GreenshotInterop/OfficeInterop/WordInterop.cs b/GreenshotInterop/OfficeInterop/WordInterop.cs
new file mode 100644
index 000000000..df22ff375
--- /dev/null
+++ b/GreenshotInterop/OfficeInterop/WordInterop.cs
@@ -0,0 +1,79 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 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 .
+ */
+using System;
+using System.Collections;
+using Greenshot.Interop;
+
+namespace Greenshot.Interop.Office {
+ // See http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.applicationclass_members%28v=Office.11%29.aspx
+ [ComProgId("Word.Application")]
+ public interface IWordApplication : Common {
+ IWordDocument ActiveDocument { get; }
+ ISelection Selection { get; }
+ IDocuments Documents { get; }
+ bool Visible { get; set; }
+ }
+
+ // See: http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.documents_members(v=office.11).aspx
+ public interface IDocuments : Common, Collection {
+ void Add(ref object Template, ref object NewTemplate, ref object DocumentType, ref object Visible);
+ IWordDocument item(int index);
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.document.aspx
+ public interface IWordDocument : Common {
+ IWordApplication Application { get; }
+ Window ActiveWindow { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.window_members.aspx
+ public interface Window : Common {
+ Pane ActivePane { get; }
+ string Caption {
+ get;
+ }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.pane_members.aspx
+ public interface Pane : Common {
+ View View { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.view_members.aspx
+ public interface View : Common {
+ Zoom Zoom { get; }
+ }
+
+ // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.zoom_members.aspx
+ public interface Zoom : Common {
+ int Percentage { get; set; }
+ }
+
+ // See: http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.selection_members(v=office.11).aspx
+ public interface ISelection : Common {
+ IInlineShapes InlineShapes { get; }
+ void InsertAfter(string text);
+ }
+
+ public interface IInlineShapes : Common {
+ object AddPicture(string FileName, object LinkToFile, object SaveWithDocument, object Range);
+ }
+}
diff --git a/GreenshotInterop/Properties/AssemblyInfo.cs b/GreenshotInterop/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..03de139d0
--- /dev/null
+++ b/GreenshotInterop/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Allgemeine Informationen über eine Assembly werden über die folgenden
+// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
+// die mit einer Assembly verknüpft sind.
+[assembly: AssemblyTitle("GreenshotInterop")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("ING-DiBa AG")]
+[assembly: AssemblyProduct("GreenshotInterop")]
+[assembly: AssemblyCopyright("Copyright © ING-DiBa AG 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
+// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
+// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
+[assembly: ComVisible(false)]
+
+// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
+[assembly: Guid("6159ccd8-d61b-4dde-8847-57bbb8a749f8")]
+
+// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
+//
+// Hauptversion
+// Nebenversion
+// Buildnummer
+// Revision
+//
+// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
+// übernehmen, indem Sie "*" eingeben:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]