File: winforms\Managed\System\WinForms\UnsafeNativeMethods.cs
Project: ndp\fx\src\System.Windows.Forms.csproj (System.Windows.Forms)
//------------------------------------------------------------------------------
// <copyright file="UnsafeNativeMethods.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>                                                                
//------------------------------------------------------------------------------
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Versioning;
 
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Boolean,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Boolean,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Int32[]):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.IntPtr):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Object&):System.Int32")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Object&):System.Int32")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.String):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Text.StringBuilder):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+CHARFORMAT2A):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+CHARFORMATA):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+CHARFORMATW):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+CHARRANGE):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+EDITSTREAM):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+EDITSTREAM64):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+FINDTEXT):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+HDLAYOUT&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LOGFONT):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVBKIMAGE):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVCOLUMN):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVCOLUMN_T):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVFINDINFO&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVGROUP):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVHITTESTINFO&):System.Int32")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVHITTESTINFO&):System.Int32")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVHITTESTINFO):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVINSERTMARK):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVINSERTMARK):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVITEM&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVTILEVIEWINFO):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVTILEVIEWINFO):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+MCHITTESTINFO):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+MSG):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+MSG):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+PARAFORMAT):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+POINT):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+RECT&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+REPASTESPECIAL):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+SIZE):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+SYSTEMTIME):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+SYSTEMTIMEARRAY):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TBBUTTON&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TBBUTTONINFO&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TCITEM_T):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TEXTRANGE):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TOOLINFO_T):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TOOLINFO_TOOLTIP):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TV_HITTESTINFO):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TV_INSERTSTRUCT&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TV_ITEM&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Runtime.InteropServices.HandleRef,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Windows.Forms.NativeMethods+GETTEXTLENGTHEX,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Drawing.Rectangle&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Windows.Forms.NativeMethods+POINT,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.PostMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.IntPtr):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.PostMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.IntPtr):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods..ctor()")]
[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+SMsoComponentManager..ctor()")]
 
// Verified that current call stacks that use these don't expose them in an unsafe fashion.
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.ClipCursor(System.Windows.Forms.NativeMethods+COMRECT):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.ClipCursor(System.Windows.Forms.NativeMethods+RECT&):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetClientRect(System.Runtime.InteropServices.HandleRef,System.IntPtr):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetProcAddress(System.Runtime.InteropServices.HandleRef,System.String):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetRegionData(System.Runtime.InteropServices.HandleRef,System.Int32,System.IntPtr):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GlobalFree(System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GlobalLock(System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GlobalUnlock(System.Runtime.InteropServices.HandleRef):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.IsChild(System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+HDLAYOUT&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.ImmNotifyIME(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Int32):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetAncestor(System.Runtime.InteropServices.HandleRef,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetFocus():System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SetFocus(System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(System.Guid&,System.Object,System.Int32,System.Guid&):System.Object")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.CoRegisterMessageFilter(System.Runtime.InteropServices.HandleRef,System.IntPtr&):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(System.Windows.Forms.NativeMethods+MSG&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.EnableScrollBar(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.EnumThreadWindows(System.Int32,System.Windows.Forms.NativeMethods+EnumThreadWindowsCallback,System.Runtime.InteropServices.HandleRef):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetForegroundWindow():System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetMenu(System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetMenuItemInfo(System.Runtime.InteropServices.HandleRef,System.Int32,System.Boolean,System.Windows.Forms.NativeMethods+MENUITEMINFO_T_RW):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetMessageA(System.Windows.Forms.NativeMethods+MSG&,System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetMessageW(System.Windows.Forms.NativeMethods+MSG&,System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetObject(System.Runtime.InteropServices.HandleRef,System.Int32,System.Windows.Forms.NativeMethods+BITMAP):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetShortPathName(System.String,System.String,System.UInt32):System.UInt32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetSystemPowerStatus(System.Windows.Forms.NativeMethods+SYSTEM_POWER_STATUS&):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetTempFileName(System.String,System.String,System.Int32,System.Text.StringBuilder):System.Void")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetWindowText(System.Runtime.InteropServices.HandleRef,System.Text.StringBuilder,System.Int32):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.IntCloseHandle(System.Runtime.InteropServices.HandleRef):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.IntCreateCompatibleDC(System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.IntCreateIC(System.String,System.String,System.String,System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.IntDuplicateHandle(System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef,System.IntPtr&,System.Int32,System.Boolean,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.IntOleInitialize(System.Int32):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.IsDialogMessage(System.Runtime.InteropServices.HandleRef,System.Windows.Forms.NativeMethods+MSG&):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.OleUninitialize():System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.PostThreadMessage(System.Int32,System.Int32,System.IntPtr,System.IntPtr):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Object&):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+CHARFORMAT2A):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+EDITSTREAM64):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVBKIMAGE):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVGROUP):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVINSERTMARK):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+LVTILEVIEWINFO):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Windows.Forms.NativeMethods+TOOLINFO_TOOLTIP):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Runtime.InteropServices.HandleRef,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Windows.Forms.NativeMethods+GETTEXTLENGTHEX,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SendMessage(System.Runtime.InteropServices.HandleRef,System.Int32,System.Windows.Forms.NativeMethods+POINT,System.Windows.Forms.NativeMethods+LVINSERTMARK):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SystemParametersInfo(System.Int32,System.Int32,System.IntPtr[],System.Int32):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.TranslateMessage(System.Windows.Forms.NativeMethods+MSG&):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.WaitMessage():System.Void")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetShortPathName(System.String,System.Text.StringBuilder,System.UInt32):System.UInt32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetWindowLong32(System.Runtime.InteropServices.HandleRef,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetWindowLongPtr64(System.Runtime.InteropServices.HandleRef,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.OleCreateIPictureIndirect(System.Object,System.Guid&,System.Boolean):System.Windows.Forms.UnsafeNativeMethods+IPicture")]
 
// Verified that current call stacks that use this seem to be safe.
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+ThemingScope.GetCurrentActCtx(System.IntPtr&):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+ThemingScope.ActivateActCtx(System.IntPtr,System.IntPtr&):System.Boolean")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+ThemingScope.CreateActCtx(System.Windows.Forms.UnsafeNativeMethods+ThemingScope+ACTCTX&):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+ThemingScope.DeactivateActCtx(System.Int32,System.IntPtr):System.Boolean")]
 
// SEC 
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.CopyMemory(System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef,System.Int32):System.Void")]
 
// SEC 
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GlobalAlloc(System.Int32,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GlobalReAlloc(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.CopyMemoryW(System.IntPtr,System.String,System.Int32):System.Void")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.CopyMemoryW(System.IntPtr,System.Char[],System.Int32):System.Void")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.CopyMemoryA(System.IntPtr,System.String,System.Int32):System.Void")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.CopyMemory(System.IntPtr,System.Byte[],System.Int32):System.Void")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.WideCharToMultiByte(System.Int32,System.Int32,System.String,System.Int32,System.Byte[],System.Int32,System.IntPtr,System.IntPtr):System.Int32")]
 
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SetWindowLongPtr64(System.Runtime.InteropServices.HandleRef,System.Int32,System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SetWindowLongPtr32(System.Runtime.InteropServices.HandleRef,System.Int32,System.Runtime.InteropServices.HandleRef):System.IntPtr")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SHLoadIndirectString(System.String,System.Text.StringBuilder,System.UInt32,System.IntPtr):System.UInt32")]
 
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+Shell32.SHCreateShellItem(System.IntPtr,System.IntPtr,System.IntPtr,System.Windows.Forms.FileDialogNative+IShellItem&):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+Shell32.SHGetFolderPathExPrivate(System.Guid&,System.UInt32,System.IntPtr,System.Text.StringBuilder,System.UInt32):System.Int32")]
[assembly: SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+Shell32.SHILCreateFromPath(System.String,System.IntPtr&,System.UInt32&):System.Int32")]
 
namespace System.Windows.Forms {
 
    using Accessibility;
    using System.Runtime.InteropServices;
    using System.Runtime.InteropServices.ComTypes;
    using System.Runtime.ConstrainedExecution;
    using System;
    using System.Security.Permissions;
    using System.Collections;
    using System.IO;
    using System.Text;
    using System.Security;
    using System.Diagnostics;
    using System.Diagnostics.CodeAnalysis;
    using System.Drawing;
 
    using IComDataObject = System.Runtime.InteropServices.ComTypes.IDataObject;
 
    [
    SuppressUnmanagedCodeSecurity()
    ]
    internal static class UnsafeNativeMethods {
 
        [DllImport(ExternDll.Shlwapi, CharSet=CharSet.Unicode, ExactSpelling=true)]
        [ResourceExposure(ResourceScope.None)]
        internal static extern uint SHLoadIndirectString(string pszSource, StringBuilder pszOutBuf, uint cchOutBuf, IntPtr ppvReserved);
    
        [DllImport(ExternDll.Ole32)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int ReadClassStg(HandleRef pStg, [In, Out] ref Guid pclsid);
 
        [DllImport(ExternDll.Ole32, SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = true)]
        internal extern static void CoTaskMemFree(IntPtr pv);
 
        [DllImport(ExternDll.User32)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetClassName(HandleRef hwnd, StringBuilder lpClassName, int nMaxCount);
 
        //SetClassLong won't work correctly for 64-bit: we should use SetClassLongPtr instead.  On
        //32-bit, SetClassLongPtr is just #defined as SetClassLong.  SetClassLong really should 
        //take/return int instead of IntPtr/HandleRef, but since we're running this only for 32-bit
        //it'll be OK.
        public static IntPtr SetClassLong(HandleRef hWnd, int nIndex, IntPtr dwNewLong)
        {
            if (IntPtr.Size == 4)
            {
                return SetClassLongPtr32(hWnd, nIndex, dwNewLong);
            }
            return SetClassLongPtr64(hWnd, nIndex, dwNewLong);
        }
        [DllImport(ExternDll.User32, CharSet = System.Runtime.InteropServices.CharSet.Auto, EntryPoint = "SetClassLong")]
        [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetClassLongPtr32(HandleRef hwnd, int nIndex, IntPtr dwNewLong);
        [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")]
        [DllImport(ExternDll.User32, CharSet = System.Runtime.InteropServices.CharSet.Auto, EntryPoint = "SetClassLongPtr")]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetClassLongPtr64(HandleRef hwnd, int nIndex, IntPtr dwNewLong);
 
        [DllImport(ExternDll.Ole32, ExactSpelling=true, PreserveSig=false)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern UnsafeNativeMethods.IClassFactory2 CoGetClassObject(
            [In]
            ref Guid clsid,
            int dwContext,
            int serverInfo,
            [In]
            ref Guid refiid);
 
        [return: MarshalAs(UnmanagedType.Interface)][DllImport(ExternDll.Ole32, ExactSpelling=true, PreserveSig=false)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern object CoCreateInstance(
            [In]
            ref Guid clsid,
            [MarshalAs(UnmanagedType.Interface)]
            object punkOuter,
            int context,
            [In]
            ref Guid iid);
 
        //This marshals differently than NativeMethods.POINTSTRUCT
        internal struct POINTSTRUCT {
            public int x;
            public int y;
 
            public POINTSTRUCT(int x, int y) {
                this.x = x;
                this.y = y;
            }
        }
 
        // We need this for Vista specific features/fixes
        private static readonly Version VistaOSVersion = new Version(6, 0);
 
        /// <summary>
        /// Used to tell if Vista API's are supported
        /// </summary>
        internal static bool IsVista
        {
            get
            {
                OperatingSystem os = Environment.OSVersion;
                if (os == null)
                    return false;
 
                return (os.Platform == PlatformID.Win32NT) &&
                       (os.Version.CompareTo(VistaOSVersion) >= 0);
            }
        }
 
        [DllImport(ExternDll.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
        [ResourceExposure(ResourceScope.AppDomain)]
        public static extern int GetLocaleInfo(int Locale,int LCType,StringBuilder lpLCData,int cchData) ;
 
        [DllImport(ExternDll.Ole32)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int WriteClassStm(IStream pStream, ref Guid clsid);
 
        [DllImport(ExternDll.Ole32)]
        [ResourceExposure(ResourceScope.Machine)]
        public static extern int ReadClassStg(IStorage pStorage, [Out]out Guid clsid);
 
        [DllImport(ExternDll.Ole32)]
        [ResourceExposure(ResourceScope.Machine)]
        public static extern int ReadClassStm(IStream pStream, [Out]out Guid clsid);
 
        [DllImport(ExternDll.Ole32)]
        [ResourceExposure(ResourceScope.Machine)]
        public static extern int OleLoadFromStream(IStream pStorage, ref Guid iid, out IOleObject pObject);
        [DllImport(ExternDll.Ole32)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int OleSaveToStream(IPersistStream pPersistStream, IStream pStream);
 
        [DllImport(ExternDll.Ole32)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int CoGetMalloc(int dwReserved, out IMalloc pMalloc);
        
        /* Commenting this out until someone actually needs to use it again...
        [DllImport(ExternDll.Ole32)]
          public static extern int OleSetMenuDescriptor(IntPtr hOleMenu, IntPtr hWndFrame, IntPtr hWndActiveObject, IOleInPlaceFrame frame, IOleInPlaceActiveObject activeObject);
        */
 
        /* Commenting this out until someone actually needs to use it again...
        [DllImport(ExternDll.Kernel32)]
        public static extern bool IsBadReadPtr(HandleRef ptr, int size);
        */
 
        [DllImport(ExternDll.Comdlg32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool PageSetupDlg([In, Out] NativeMethods.PAGESETUPDLG lppsd);
 
        [DllImport(ExternDll.Comdlg32, EntryPoint = "PrintDlg", SetLastError = true, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool PrintDlg_32([In, Out] NativeMethods.PRINTDLG_32 lppd);
 
        [DllImport(ExternDll.Comdlg32, EntryPoint = "PrintDlg", SetLastError = true, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool PrintDlg_64([In, Out] NativeMethods.PRINTDLG_64 lppd);
 
        public static bool PrintDlg([In, Out] NativeMethods.PRINTDLG lppd) {
            if (IntPtr.Size == 4) {
                NativeMethods.PRINTDLG_32 lppd_32 = lppd as NativeMethods.PRINTDLG_32;
                if (lppd_32 == null) {
                    throw new System.NullReferenceException("PRINTDLG data is null");
                }
                return PrintDlg_32(lppd_32);
            }
            else {
                NativeMethods.PRINTDLG_64 lppd_64 = lppd as NativeMethods.PRINTDLG_64;
                if (lppd_64 == null) {
                    throw new System.NullReferenceException("PRINTDLG data is null");
                }
                return PrintDlg_64(lppd_64);
            }
        }
 
        [DllImport(ExternDll.Comdlg32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int PrintDlgEx([In, Out] NativeMethods.PRINTDLGEX lppdex);
        [DllImport(ExternDll.Ole32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int OleGetClipboard(ref IComDataObject data);
        [DllImport(ExternDll.Ole32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int OleSetClipboard(IComDataObject pDataObj);
        [DllImport(ExternDll.Ole32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int OleFlushClipboard();
        [DllImport(ExternDll.Oleaut32, ExactSpelling=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void OleCreatePropertyFrameIndirect(NativeMethods.OCPFIPARAMS p);
        [DllImport(ExternDll.Oleaut32, EntryPoint = "OleCreateFontIndirect", ExactSpelling = true, PreserveSig = false)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern UnsafeNativeMethods.IFont OleCreateIFontIndirect(NativeMethods.FONTDESC fd, ref Guid iid);
        [DllImport(ExternDll.Oleaut32, EntryPoint = "OleCreatePictureIndirect", ExactSpelling = true, PreserveSig = false)]
        [ResourceExposure(ResourceScope.Machine)]
        public static extern UnsafeNativeMethods.IPicture OleCreateIPictureIndirect([MarshalAs(UnmanagedType.AsAny)]object pictdesc, ref Guid iid, bool fOwn);
        [DllImport(ExternDll.Oleaut32, EntryPoint = "OleCreatePictureIndirect", ExactSpelling = true, PreserveSig = false)]
        [ResourceExposure(ResourceScope.Machine)]
        public static extern UnsafeNativeMethods.IPictureDisp OleCreateIPictureDispIndirect([MarshalAs(UnmanagedType.AsAny)] object pictdesc, ref Guid iid, bool fOwn);
        // cpb: #8309 -- next two methods, refiid arg must be IPicture.iid
        [DllImport(ExternDll.Oleaut32, PreserveSig = false)]
        [ResourceExposure(ResourceScope.Machine)]
        public static extern UnsafeNativeMethods.IPicture OleCreatePictureIndirect(NativeMethods.PICTDESC pictdesc, [In]ref Guid refiid, bool fOwn);
        [DllImport(ExternDll.Oleaut32, PreserveSig = false)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern UnsafeNativeMethods.IFont OleCreateFontIndirect(NativeMethods.tagFONTDESC fontdesc, [In]ref Guid refiid);
        [DllImport(ExternDll.Oleaut32, ExactSpelling = true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int VarFormat(ref object pvarIn, HandleRef pstrFormat, int iFirstDay, int iFirstWeek, uint dwFlags, [In, Out]ref IntPtr pbstr);
        [DllImport(ExternDll.Shell32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int DragQueryFile(HandleRef hDrop, int iFile, StringBuilder lpszFile, int cch);
 
        public static int DragQueryFileLongPath(HandleRef hDrop, int iFile, StringBuilder lpszFile)
        {
            if (null != lpszFile && 0 != lpszFile.Capacity && iFile != unchecked((int)0xFFFFFFFF))
            {
                int resultValue = 0;
 
                // iterating by allocating chunk of memory each time we find the length is not sufficient.
                // Performance should not be an issue for current MAX_PATH length due to this
                if ((resultValue = DragQueryFile(hDrop, iFile, lpszFile, lpszFile.Capacity)) == lpszFile.Capacity)
                {
                    // passing null for buffer will return actual number of charectors in the file name.
                    // So, one extra call would be suffice to avoid while loop in case of long path.
                    int capacity = DragQueryFile(hDrop, iFile, null, 0);
                    if (capacity < NativeMethods.MAX_UNICODESTRING_LEN)
                    {
                        lpszFile.EnsureCapacity(capacity);
                        resultValue = DragQueryFile(hDrop, iFile, lpszFile, capacity);
                    }
                    else
                    {
                        resultValue = 0;
                    }
                }
 
                lpszFile.Length = resultValue;
                return resultValue;  // what ever the result.
            }
            else
            {
                return DragQueryFile(hDrop, iFile, lpszFile, lpszFile.Capacity);
            }
        }
        [DllImport(ExternDll.User32, ExactSpelling=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool EnumChildWindows(HandleRef hwndParent, NativeMethods.EnumChildrenCallback lpEnumFunc, HandleRef lParam);
        [DllImport(ExternDll.Shell32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr ShellExecute(HandleRef hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
        [DllImport(ExternDll.Shell32, CharSet=CharSet.Auto, EntryPoint="ShellExecute", BestFitMapping = false)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr ShellExecute_NoBFM(HandleRef hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int SetScrollPos(HandleRef hWnd, int nBar, int nPos, bool bRedraw);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool EnableScrollBar(HandleRef hWnd, int nBar, int value);
 
        [DllImport(ExternDll.Shell32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int Shell_NotifyIcon(int message, NativeMethods.NOTIFYICONDATA pnid);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static bool InsertMenuItem(HandleRef hMenu, int uItem, bool fByPosition, NativeMethods.MENUITEMINFO_T lpmii);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr  GetMenu(HandleRef hWnd);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, [In, Out] NativeMethods.MENUITEMINFO_T lpmii);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, [In, Out] NativeMethods.MENUITEMINFO_T_RW lpmii);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static bool SetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, NativeMethods.MENUITEMINFO_T lpmii);
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="CreateMenu", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntCreateMenu();
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr CreateMenu() {
            return System.Internal.HandleCollector.Add(IntCreateMenu(), NativeMethods.CommonHandles.Menu);
        }
        
        [DllImport(ExternDll.Comdlg32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetOpenFileName([In, Out] NativeMethods.OPENFILENAME_I ofn);
 
        [DllImport(ExternDll.User32, ExactSpelling=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool EndDialog(HandleRef hWnd, IntPtr result);
 
        public const int MB_PRECOMPOSED = 0x00000001;
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Unicode, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int MultiByteToWideChar(int CodePage, int dwFlags, byte[] lpMultiByteStr, int cchMultiByte, char[] lpWideCharStr, int cchWideChar);
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Unicode)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int WideCharToMultiByte(int codePage, int flags, [MarshalAs(UnmanagedType.LPWStr)]string wideStr, int chars, [In,Out]byte[] pOutBytes, int bufferBytes, IntPtr defaultChar, IntPtr pDefaultUsed);
 
        [DllImport(ExternDll.Kernel32, SetLastError=true, ExactSpelling=true, EntryPoint="RtlMoveMemory", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void CopyMemory(HandleRef destData, HandleRef srcData, int size);
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="RtlMoveMemory")]
        [ResourceExposure(ResourceScope.None)]
        public static extern void CopyMemory(IntPtr pdst, byte[] psrc, int cb);
 
        [DllImport(ExternDll.Kernel32, ExactSpelling = true, EntryPoint = "RtlMoveMemory", CharSet = CharSet.Unicode)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void CopyMemoryW(IntPtr pdst, string psrc, int cb);
        [DllImport(ExternDll.Kernel32, ExactSpelling = true, EntryPoint = "RtlMoveMemory", CharSet = CharSet.Unicode)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void CopyMemoryW(IntPtr pdst, char[] psrc, int cb);
 
        [DllImport(ExternDll.Kernel32, ExactSpelling = true, EntryPoint = "RtlMoveMemory", CharSet = CharSet.Ansi)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void CopyMemoryA(IntPtr pdst, string psrc, int cb);
        [DllImport(ExternDll.Kernel32, ExactSpelling = true, EntryPoint = "RtlMoveMemory", CharSet = CharSet.Ansi)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void CopyMemoryA(IntPtr pdst, char[] psrc, int cb);
        
        
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, EntryPoint="DuplicateHandle", SetLastError=true)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntDuplicateHandle(HandleRef processSource, HandleRef handleSource, HandleRef processTarget, ref IntPtr handleTarget, int desiredAccess, bool inheritHandle, int options);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr DuplicateHandle(HandleRef processSource, HandleRef handleSource, HandleRef processTarget, ref IntPtr handleTarget, int desiredAccess, bool inheritHandle, int options) {
            IntPtr ret = IntDuplicateHandle(processSource, handleSource, processTarget, ref handleTarget,
                                         desiredAccess, inheritHandle, options);
            System.Internal.HandleCollector.Add(handleTarget, NativeMethods.CommonHandles.Kernel);
            return ret;
        }
        
        [DllImport(ExternDll.Ole32, PreserveSig=false)]
        [ResourceExposure(ResourceScope.None)]
        public static extern UnsafeNativeMethods.IStorage StgOpenStorageOnILockBytes(UnsafeNativeMethods.ILockBytes iLockBytes, UnsafeNativeMethods.IStorage pStgPriority, int grfMode, int sndExcluded, int reserved);
        [DllImport(ExternDll.Ole32, PreserveSig=false)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetHGlobalFromILockBytes(UnsafeNativeMethods.ILockBytes pLkbyt);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetWindowsHookEx(int hookid, NativeMethods.HookProc pfnhook, HandleRef hinst, int threadid);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetKeyboardState(byte [] keystate);
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="keybd_event", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void Keybd_event(byte vk, byte scan, int flags, int extrainfo);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int SetKeyboardState(byte [] keystate);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool UnhookWindowsHookEx(HandleRef hhook);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern short GetAsyncKeyState(int vkey);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr CallNextHookEx(HandleRef hhook, int code, IntPtr wparam, IntPtr lparam);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int ScreenToClient( HandleRef hWnd, [In, Out] NativeMethods.POINT pt );
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto, SetLastError = true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetModuleFileName(HandleRef hModule, StringBuilder buffer, int length);
        public static StringBuilder GetModuleFileNameLongPath(HandleRef hModule)
        {
            StringBuilder buffer = new StringBuilder(NativeMethods.MAX_PATH);
            int noOfTimes = 1;
            int length = 0;
            // Iterating by allocating chunk of memory each time we find the length is not sufficient.
            // Performance should not be an issue for current MAX_PATH length due to this change.
            while (((length = GetModuleFileName(hModule, buffer, buffer.Capacity)) == buffer.Capacity) 
                && Marshal.GetLastWin32Error() == NativeMethods.ERROR_INSUFFICIENT_BUFFER 
                && buffer.Capacity < NativeMethods.MAX_UNICODESTRING_LEN)
            {
                noOfTimes += 2; // Increasing buffer size by 520 in each iteration.
                int capacity = noOfTimes * NativeMethods.MAX_PATH < NativeMethods.MAX_UNICODESTRING_LEN ? noOfTimes * NativeMethods.MAX_PATH : NativeMethods.MAX_UNICODESTRING_LEN;
                buffer.EnsureCapacity(capacity);
            }
            buffer.Length = length;
            return buffer;
        }
        [DllImport(ExternDll.User32, CharSet=CharSet.Unicode)]
        [ResourceExposure(ResourceScope.None)]        
        public static extern bool IsDialogMessage(HandleRef hWndDlg, [In, Out] ref NativeMethods.MSG msg);        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool TranslateMessage([In, Out] ref NativeMethods.MSG msg);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr DispatchMessage([In] ref NativeMethods.MSG msg);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Ansi)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr DispatchMessageA([In] ref NativeMethods.MSG msg);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Unicode)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr DispatchMessageW([In] ref NativeMethods.MSG msg);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int PostThreadMessage(int id, int msg, IntPtr wparam, IntPtr lparam);
        [DllImport(ExternDll.Ole32, ExactSpelling=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int CoRegisterMessageFilter(HandleRef newFilter, ref IntPtr oldMsgFilter);
        [DllImport(ExternDll.Ole32, ExactSpelling=true, EntryPoint="OleInitialize", SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        private static extern int IntOleInitialize(int val);
        public static int OleInitialize() {
            return IntOleInitialize(0);
        }
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static bool EnumThreadWindows(int dwThreadId, NativeMethods.EnumThreadWindowsCallback lpfn, HandleRef lParam);
        [return:MarshalAs(UnmanagedType.Bool)] [DllImport(ExternDll.Kernel32, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public extern static bool GetExitCodeThread(IntPtr hThread, out uint lpExitCode);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static IntPtr SendDlgItemMessage(HandleRef hDlg, int nIDDlgItem, int Msg, IntPtr wParam, IntPtr lParam);
        [DllImport(ExternDll.Ole32, ExactSpelling=true, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int OleUninitialize();
        [DllImport(ExternDll.Comdlg32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetSaveFileName([In, Out] NativeMethods.OPENFILENAME_I ofn);
        [DllImport(ExternDll.User32, EntryPoint="ChildWindowFromPointEx", ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern IntPtr _ChildWindowFromPointEx(HandleRef hwndParent, POINTSTRUCT pt, int uFlags);
        public static IntPtr ChildWindowFromPointEx(HandleRef hwndParent, int x, int y, int uFlags) {
            POINTSTRUCT ps = new POINTSTRUCT(x, y);
            return _ChildWindowFromPointEx(hwndParent, ps, uFlags);
        }
        [DllImport(ExternDll.Kernel32, EntryPoint="CloseHandle", ExactSpelling=true, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        private static extern bool IntCloseHandle(HandleRef handle);
        public static bool CloseHandle(HandleRef handle) {
            System.Internal.HandleCollector.Remove((IntPtr)handle, NativeMethods.CommonHandles.Kernel);
            return IntCloseHandle(handle);
        }
        
        [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, EntryPoint="CreateCompatibleDC", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntCreateCompatibleDC(HandleRef hDC);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr CreateCompatibleDC(HandleRef hDC) {
            return System.Internal.HandleCollector.Add(IntCreateCompatibleDC(hDC), NativeMethods.CommonHandles.CompatibleHDC);
        }
 
        #region SendKeys SendInput functionality
 
        [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool BlockInput([In, MarshalAs(UnmanagedType.Bool)] bool fBlockIt);
 
        [DllImport(ExternDll.User32, ExactSpelling = true, SetLastError=true, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern uint SendInput(uint nInputs, NativeMethods.INPUT[] pInputs, int cbSize);
 
        #endregion
 
        /*
        [DllImport(ExternDll.Kernel32, EntryPoint = "CreateFileMapping", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr IntCreateFileMapping(HandleRef hFile, IntPtr lpAttributes, int flProtect, int dwMaxSizeHi, int dwMaxSizeLow, string lpName);
        public static IntPtr CreateFileMapping(HandleRef hFile, IntPtr lpAttributes, int flProtect, int dwMaxSizeHi, int dwMaxSizeLow, string lpName) {
            return System.Internal.HandleCollector.Add(IntCreateFileMapping(hFile, lpAttributes, flProtect, dwMaxSizeHi, dwMaxSizeLow, lpName), NativeMethods.CommonHandles.Kernel);
        }
 
        [DllImport(ExternDll.Kernel32, EntryPoint = "OpenFileMapping", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr IntOpenFileMapping(int dwDesiredAccess, bool bInheritHandle, string lpName);
        public static IntPtr OpenFileMapping(int dwDesiredAccess, bool bInheritHandle, string lpName) {
            return System.Internal.HandleCollector.Add(IntOpenFileMapping(dwDesiredAccess, bInheritHandle, lpName), NativeMethods.CommonHandles.Kernel);
        }
*/
 
        [DllImport(ExternDll.Kernel32, EntryPoint = "MapViewOfFile", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]            
        [ResourceExposure(ResourceScope.Process)]
        [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")]
        private static extern IntPtr IntMapViewOfFile(HandleRef hFileMapping, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, int dwNumberOfBytesToMap);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr MapViewOfFile(HandleRef hFileMapping, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, int dwNumberOfBytesToMap) {
            return System.Internal.HandleCollector.Add(IntMapViewOfFile(hFileMapping, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap), NativeMethods.CommonHandles.Kernel);
        }
 
        [DllImport(ExternDll.Kernel32, EntryPoint = "UnmapViewOfFile", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]
        [ResourceExposure(ResourceScope.None)]
        private static extern bool IntUnmapViewOfFile(HandleRef pvBaseAddress);
        public static bool UnmapViewOfFile(HandleRef pvBaseAddress) {
            System.Internal.HandleCollector.Remove((IntPtr)pvBaseAddress, NativeMethods.CommonHandles.Kernel);
            return IntUnmapViewOfFile(pvBaseAddress);
        }
 
        [DllImport(ExternDll.User32, ExactSpelling = true, EntryPoint = "GetDCEx", CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntGetDCEx(HandleRef hWnd, HandleRef hrgnClip, int flags);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr GetDCEx(HandleRef hWnd, HandleRef hrgnClip, int flags) {
            return System.Internal.HandleCollector.Add(IntGetDCEx(hWnd, hrgnClip, flags), NativeMethods.CommonHandles.HDC);
        }
        
        // GetObject stuff
        [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] NativeMethods.BITMAP bm);
 
        [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] NativeMethods.LOGPEN lp);
        public static int GetObject(HandleRef hObject, NativeMethods.LOGPEN lp) {
            return GetObject(hObject, Marshal.SizeOf(typeof(NativeMethods.LOGPEN)), lp);
        }
        
        [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] NativeMethods.LOGBRUSH lb);
        public static int GetObject(HandleRef hObject, NativeMethods.LOGBRUSH lb) {
            return GetObject(hObject, Marshal.SizeOf(typeof(NativeMethods.LOGBRUSH)), lb);
        }
        
        [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] NativeMethods.LOGFONT lf);
        public static int GetObject(HandleRef hObject, NativeMethods.LOGFONT lp) {
            return GetObject(hObject, Marshal.SizeOf(typeof(NativeMethods.LOGFONT)), lp);
        }
        
        //HPALETTE
        [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetObject(HandleRef hObject, int nSize, ref int nEntries);
        [DllImport(ExternDll.Gdi32, SetLastError=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetObject(HandleRef hObject, int nSize, int[] nEntries);
        [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetObjectType(HandleRef hObject);
 
        [DllImport(ExternDll.User32, EntryPoint="CreateAcceleratorTable", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntCreateAcceleratorTable(/*ACCEL*/ HandleRef pentries, int cCount);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr CreateAcceleratorTable(/*ACCEL*/ HandleRef pentries, int cCount) {
            return System.Internal.HandleCollector.Add(IntCreateAcceleratorTable(pentries, cCount), NativeMethods.CommonHandles.Accelerator);
        }
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="DestroyAcceleratorTable", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern bool IntDestroyAcceleratorTable(HandleRef hAccel);
        public static bool DestroyAcceleratorTable(HandleRef hAccel) {
            System.Internal.HandleCollector.Remove((IntPtr)hAccel, NativeMethods.CommonHandles.Accelerator);
            return IntDestroyAcceleratorTable(hAccel);
        }
 
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern short VkKeyScan(char key);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetCapture();
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetCapture(HandleRef hwnd);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetFocus();
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetCursorPos([In, Out] NativeMethods.POINT pt);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern short GetKeyState(int keyCode);
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        [SuppressMessage("Microsoft.Security", "CA2101:SpecifyMarshalingForPInvokeStringArguments")]
        public static extern uint GetShortPathName(string lpszLongPath, StringBuilder lpszShortPath, uint cchBuffer);
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="SetWindowRgn", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern int IntSetWindowRgn(HandleRef hwnd, HandleRef hrgn, bool fRedraw);
        public static int SetWindowRgn(HandleRef hwnd, HandleRef hrgn, bool fRedraw) {
            int retval = IntSetWindowRgn(hwnd, hrgn, fRedraw);
            if (retval != 0) {
                // we do this because after a SetWindowRgn call, the system owns the region
                // so we don't need to bother cleaning it up.
                //
                System.Internal.HandleCollector.Remove((IntPtr)hrgn, NativeMethods.CommonHandles.GDI);
            }
            return retval;
        }
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetWindowText(HandleRef hWnd, StringBuilder lpString, int nMaxCount);
        
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto)]            
        [ResourceExposure(ResourceScope.None)]
        [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")]
        public static extern void GetTempFileName(string tempDirName, string prefixName, int unique, StringBuilder sb);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetWindowText(HandleRef hWnd, string text);
 
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GlobalAlloc(int uFlags, int dwBytes);
        
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GlobalReAlloc(HandleRef handle, int bytes, int flags);
 
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GlobalLock(HandleRef handle);
        
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GlobalUnlock(HandleRef handle);
        
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GlobalFree(HandleRef handle);
        
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GlobalSize(HandleRef handle);
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ImmSetConversionStatus(HandleRef hIMC, int conversion, int sentence);
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ImmGetConversionStatus(HandleRef hIMC, ref int conversion, ref int sentence);
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr ImmGetContext(HandleRef hWnd);
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ImmReleaseContext(HandleRef hWnd, HandleRef hIMC);
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr ImmAssociateContext(HandleRef hWnd, HandleRef hIMC);
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ImmDestroyContext(HandleRef hIMC);
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr ImmCreateContext();
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ImmSetOpenStatus(HandleRef hIMC, bool open);
        
        [DllImport(ExternDll.Imm32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ImmGetOpenStatus(HandleRef hIMC);
 
        [DllImport(ExternDll.Imm32, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ImmNotifyIME(HandleRef hIMC, int dwAction, int dwIndex, int dwValue);
 
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetFocus(HandleRef hWnd);
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetParent(HandleRef hWnd);
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetAncestor(HandleRef hWnd, int flags); 
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool IsChild(HandleRef hWndParent, HandleRef hwnd);
 
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        [SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
        public static extern bool IsZoomed(HandleRef hWnd);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr FindWindow(string className, string windowName);
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int MapWindowPoints(HandleRef hWndFrom, HandleRef hWndTo, [In, Out] ref NativeMethods.RECT rect, int cPoints);
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int MapWindowPoints(HandleRef hWndFrom, HandleRef hWndTo, [In, Out] NativeMethods.POINT pt, int cPoints);
 
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, bool wParam, int lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, int[] lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int[] wParam, int[] lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, ref int wParam, ref int lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, string lParam);
 
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, IntPtr wParam, string lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, StringBuilder lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.TOOLINFO_T lParam);        
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.TOOLINFO_TOOLTIP lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, ref NativeMethods.TBBUTTON lParam);        
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, ref NativeMethods.TBBUTTONINFO lParam);        
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, ref NativeMethods.TV_ITEM lParam);        
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, ref NativeMethods.TV_INSERTSTRUCT lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.TV_HITTESTINFO lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.LVBKIMAGE lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int SendMessage(HandleRef hWnd, int msg, int wParam, ref NativeMethods.LVHITTESTINFO lParam);
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.TCITEM_T lParam);
 
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, ref NativeMethods.HDLAYOUT hdlayout);
 
        //for Tooltips
        //
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, HandleRef wParam, int lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, HandleRef lParam);        
 
 
        // For RichTextBox
        //
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out, MarshalAs(UnmanagedType.LPStruct)] NativeMethods.PARAFORMAT lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out, MarshalAs(UnmanagedType.LPStruct)] NativeMethods.CHARFORMATA lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out, MarshalAs(UnmanagedType.LPStruct)] NativeMethods.CHARFORMAT2A lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out, MarshalAs(UnmanagedType.LPStruct)] NativeMethods.CHARFORMATW lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int SendMessage(HandleRef hWnd, int msg, int wParam, [Out, MarshalAs(UnmanagedType.IUnknown)]out object editOle);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.CHARRANGE lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.FINDTEXT lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.TEXTRANGE lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.POINT lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, NativeMethods.POINT wParam, int lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.REPASTESPECIAL lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.EDITSTREAM lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.EDITSTREAM64 lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, NativeMethods.GETTEXTLENGTHEX wParam, int lParam);
 
        // For Button
        //
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out] NativeMethods.SIZE lParam);        
       
        // For ListView
        //
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out] ref NativeMethods.LVFINDINFO lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.LVHITTESTINFO lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.LVCOLUMN_T lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out] ref NativeMethods.LVITEM lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.LVCOLUMN lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.LVGROUP lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, NativeMethods.POINT wParam, [In, Out] NativeMethods.LVINSERTMARK lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.LVINSERTMARK lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out] NativeMethods.LVTILEVIEWINFO lParam);        
        
        // For MonthCalendar
        //
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.MCHITTESTINFO lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.SYSTEMTIME lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.SYSTEMTIMEARRAY lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, [In, Out] NativeMethods.LOGFONT lParam);        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.MSG lParam);
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, int lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, IntPtr wParam, IntPtr lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static IntPtr SendMessage(HandleRef hWnd, int Msg, IntPtr wParam, [In, Out] ref NativeMethods.RECT lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static IntPtr SendMessage(HandleRef hWnd, int Msg, ref short wParam, ref short lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static IntPtr SendMessage(HandleRef hWnd, int Msg, [In, Out, MarshalAs(UnmanagedType.Bool)] ref bool wParam, IntPtr lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static IntPtr SendMessage(HandleRef hWnd, int Msg, int wParam, IntPtr lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static IntPtr SendMessage(HandleRef hWnd, int Msg, int wParam, [In, Out] ref NativeMethods.RECT lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static IntPtr SendMessage(HandleRef hWnd, int Msg, int wParam, [In, Out] ref Rectangle lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static IntPtr SendMessage(HandleRef hWnd, int Msg, IntPtr wParam, NativeMethods.ListViewCompareCallback pfnCompare);
       
        [DllImport(ExternDll.User32, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SendMessageTimeout(HandleRef hWnd, int msg, IntPtr wParam, IntPtr lParam, int flags, int timeout, out IntPtr pdwResult);
 
        public const int SMTO_ABORTIFHUNG = 0x0002;        
 
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetParent(HandleRef hWnd, HandleRef hWndParent);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetWindowRect(HandleRef hWnd, [In, Out] ref NativeMethods.RECT rect);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetWindow(HandleRef hWnd, int uCmd);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetDlgItem(HandleRef hWnd, int nIDDlgItem);
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GetModuleHandle(string modName);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr DefWindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr DefMDIChildProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr CallWindowProc(IntPtr wndProc, IntPtr hWnd, int msg,
                                                IntPtr wParam, IntPtr lParam);
        
/*                                               
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        public static extern IntPtr GetProp(HandleRef hWnd, int atom);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        public static extern IntPtr GetProp(HandleRef hWnd, string name);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        public static extern IntPtr RemoveProp(HandleRef hWnd, short atom);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        public static extern IntPtr RemoveProp(HandleRef hWnd, string propName);
   */
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern short GlobalDeleteAtom(short atom);
 
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Ansi)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GetProcAddress(HandleRef hModule, string lpProcName);
 
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetClassInfo(HandleRef hInst, string lpszClass, [In, Out] NativeMethods.WNDCLASS_I wc);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetClassInfo(HandleRef hInst, string lpszClass, IntPtr h);
/*
        [DllImport(ExternDll.Shell32, CharSet=CharSet.Auto)]
        public static extern int SHGetFolderPath(HandleRef hwndOwner, int nFolder, HandleRef hToken, int dwFlags, StringBuilder lpszPath);
*/        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetSystemMetrics(int nIndex);
        
        // This API is available starting Windows10 RS1
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetSystemMetricsForDpi(int nIndex, uint dpi);
 
        /// <summary>
        /// Tries to get system metrics for the dpi. dpi is ignored if "GetSystemMetricsForDpi" is not available on the OS that this application is running.
        /// </summary>
        /// <param name="nIndex">index</param>
        /// <param name="dpi">dpi requested</param>
        /// <returns>returns system metrics for dpi</returns>
        public static int TryGetSystemMetricsForDpi(int nIndex, uint dpi) {
            if (ApiHelper.IsApiAvailable(ExternDll.User32, "GetSystemMetricsForDpi")) {
                return GetSystemMetricsForDpi(nIndex, dpi);
            }
            else {
                Debug.Assert(false, "GetSystemMetricsForDpi() is not available on this OS");
                return GetSystemMetrics(nIndex);
            }
        }
 
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, ref NativeMethods.RECT rc, int nUpdate);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, ref int value, int ignore);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, ref bool value, int ignore);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, ref NativeMethods.HIGHCONTRAST_I rc, int nUpdate);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, [In, Out] NativeMethods.NONCLIENTMETRICS metrics, int nUpdate);
        
        // This API is available starting Windows10 RS1
        [DllImport(ExternDll.User32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfoForDpi(int nAction, int nParam, [In, Out] NativeMethods.NONCLIENTMETRICS metrics, int nUpdate, uint dpi);
 
        /// <summary>
        /// Tries to get system parameter info for the dpi. dpi is ignored if "SystemParametersInfoForDpi()" API is not available on the OS that this application is running.
        /// </summary>
        public static bool TrySystemParametersInfoForDpi(int nAction, int nParam, [In, Out] NativeMethods.NONCLIENTMETRICS metrics, int nUpdate, uint dpi) {
            if(ApiHelper.IsApiAvailable(ExternDll.User32, "SystemParametersInfoForDpi")) {
                return SystemParametersInfoForDpi(nAction,  nParam, metrics,  nUpdate,  dpi);
            }
            else {
                Debug.Assert(false, "SystemParametersInfoForDpi() is not available on this OS");
                return SystemParametersInfo(nAction, nParam, metrics, nUpdate);
            }
        }
/*
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, [In, Out] NativeMethods.ICONMETRICS iconMetrics, int nUpdate);
*/
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, [In, Out] NativeMethods.LOGFONT font, int nUpdate);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, bool [] flag, bool nUpdate);
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetComputerName(StringBuilder lpBuffer, int[] nSize);
        [DllImport(ExternDll.Advapi32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetUserName(StringBuilder lpBuffer, int[] nSize);
        [DllImport(ExternDll.User32, ExactSpelling=true)]
        [ResourceExposure(ResourceScope.Machine)]
        public static extern IntPtr GetProcessWindowStation();
        [DllImport(ExternDll.User32, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetUserObjectInformation(HandleRef hObj, int nIndex, [MarshalAs(UnmanagedType.LPStruct)] NativeMethods.USEROBJECTFLAGS pvBuffer, int nLength, ref int lpnLengthNeeded);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int ClientToScreen( HandleRef hWnd, [In, Out] NativeMethods.POINT pt );
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GetForegroundWindow();
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int MsgWaitForMultipleObjectsEx(int nCount, IntPtr pHandles, int dwMilliseconds, int dwWakeMask, int dwFlags);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GetDesktopWindow();
        [DllImport(ExternDll.Ole32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int RegisterDragDrop(HandleRef hwnd, UnsafeNativeMethods.IOleDropTarget target);
        [DllImport(ExternDll.Ole32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int RevokeDragDrop(HandleRef hwnd);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool PeekMessage([In, Out] ref NativeMethods.MSG msg, HandleRef hwnd, int msgMin, int msgMax, int remove);
        [DllImport(ExternDll.User32, CharSet=CharSet.Unicode)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool PeekMessageW([In, Out] ref NativeMethods.MSG msg, HandleRef hwnd, int msgMin, int msgMax, int remove);
        [DllImport(ExternDll.User32, CharSet=CharSet.Ansi)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool PeekMessageA([In, Out] ref NativeMethods.MSG msg, HandleRef hwnd, int msgMin, int msgMax, int remove);
        
/*        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto), 
         SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")]
        public static extern bool SetProp(HandleRef hWnd, int atom, HandleRef data);
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        public static extern bool SetProp(HandleRef hWnd, string propName, HandleRef data);
*/
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool PostMessage(HandleRef hwnd, int msg, IntPtr wparam, IntPtr lparam);
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern short GlobalAddAtom(string atomName);
        [DllImport(ExternDll.Oleacc, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr LresultFromObject(ref Guid refiid, IntPtr wParam, HandleRef pAcc);
        [DllImport(ExternDll.Oleacc, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int CreateStdAccessibleObject(HandleRef hWnd, int objID, ref Guid refiid, [In, Out, MarshalAs(UnmanagedType.Interface)] ref object pAcc);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void NotifyWinEvent(int winEvent, HandleRef hwnd, int objType, int objID);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetMenuItemID(HandleRef hMenu, int nPos);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetSubMenu(HandleRef hwnd, int index);
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetMenuItemCount(HandleRef hMenu);
        [DllImport(ExternDll.Oleaut32, PreserveSig=false)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void GetErrorInfo(int reserved, [In, Out] ref UnsafeNativeMethods.IErrorInfo errorInfo);
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="BeginPaint", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern IntPtr IntBeginPaint(HandleRef hWnd, [In, Out] ref NativeMethods.PAINTSTRUCT lpPaint);
        public static IntPtr BeginPaint(HandleRef hWnd, [In, Out, MarshalAs(UnmanagedType.LPStruct)] ref NativeMethods.PAINTSTRUCT lpPaint) {
            return System.Internal.HandleCollector.Add(IntBeginPaint(hWnd, ref lpPaint), NativeMethods.CommonHandles.HDC);
        }
        
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="EndPaint", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern bool IntEndPaint(HandleRef hWnd, ref NativeMethods.PAINTSTRUCT lpPaint);
        public static bool EndPaint(HandleRef hWnd, [In, MarshalAs(UnmanagedType.LPStruct)] ref NativeMethods.PAINTSTRUCT lpPaint) {
            System.Internal.HandleCollector.Remove(lpPaint.hdc, NativeMethods.CommonHandles.HDC);
            return IntEndPaint(hWnd, ref lpPaint);
        }
 
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="GetDC", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntGetDC(HandleRef hWnd);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr GetDC(HandleRef hWnd) {
            return System.Internal.HandleCollector.Add(IntGetDC(hWnd), NativeMethods.CommonHandles.HDC);
        }
 
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="GetWindowDC", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntGetWindowDC(HandleRef hWnd);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr GetWindowDC(HandleRef hWnd) {
            return System.Internal.HandleCollector.Add(IntGetWindowDC(hWnd), NativeMethods.CommonHandles.HDC);
        }
        
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="ReleaseDC", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern int IntReleaseDC(HandleRef hWnd, HandleRef hDC);
        public static int ReleaseDC(HandleRef hWnd, HandleRef hDC) {
            System.Internal.HandleCollector.Remove((IntPtr)hDC, NativeMethods.CommonHandles.HDC);
            return IntReleaseDC(hWnd, hDC);
        }
 
        [DllImport(ExternDll.Gdi32, SetLastError=true, EntryPoint="CreateDC", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntCreateDC(string lpszDriver, string lpszDeviceName, string lpszOutput, HandleRef devMode);
        
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr CreateDC(string lpszDriver) {
            return System.Internal.HandleCollector.Add(IntCreateDC(lpszDriver, null, null, NativeMethods.NullHandleRef), NativeMethods.CommonHandles.HDC);
        }
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr CreateDC(string lpszDriverName, string lpszDeviceName, string lpszOutput, HandleRef /*DEVMODE*/ lpInitData) {
            return System.Internal.HandleCollector.Add(IntCreateDC(lpszDriverName, lpszDeviceName, lpszOutput, lpInitData), NativeMethods.CommonHandles.HDC);
        }
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SystemParametersInfo(int nAction, int nParam, [In, Out] IntPtr[] rc, int nUpdate);
        
        [DllImport(ExternDll.User32, EntryPoint="SendMessage", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        //public extern static IntPtr SendCallbackMessage(HandleRef hWnd, int Msg, IntPtr wParam, UnsafeNativeMethods.IRichTextBoxOleCallback lParam);
        public extern static IntPtr SendCallbackMessage(HandleRef hWnd, int Msg, IntPtr wParam, IntPtr lParam);
        
        [DllImport(ExternDll.Shell32, ExactSpelling=true, CharSet=CharSet.Ansi)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void DragAcceptFiles(HandleRef hWnd, bool fAccept);
       
        [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetDeviceCaps(HandleRef hDC, int nIndex);
 
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetScrollInfo(HandleRef hWnd, int fnBar, NativeMethods.SCROLLINFO si);
       
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int SetScrollInfo(HandleRef hWnd, int fnBar, NativeMethods.SCROLLINFO si, bool redraw);
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GetActiveWindow();
 
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.Machine)]
        private static extern IntPtr LoadLibrary(string libname);
       
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
        [ResourceExposure(ResourceScope.Machine)]
        private static extern IntPtr LoadLibraryEx(string lpModuleName, IntPtr hFile, uint dwFlags);
 
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool FreeLibrary(HandleRef hModule);
 
        //GetWindowLong won't work correctly for 64-bit: we should use GetWindowLongPtr instead.  On
        //32-bit, GetWindowLongPtr is just #defined as GetWindowLong.  GetWindowLong really should 
        //take/return int instead of IntPtr/HandleRef, but since we're running this only for 32-bit
        //it'll be OK.
        public static IntPtr GetWindowLong(HandleRef hWnd, int nIndex)
        {
            if (IntPtr.Size == 4)
            {
                return GetWindowLong32(hWnd, nIndex);
            }
            return GetWindowLongPtr64(hWnd, nIndex);
        }
        [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")]
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "GetWindowLong")]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetWindowLong32(HandleRef hWnd, int nIndex);
 
        [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")]
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "GetWindowLongPtr")]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetWindowLongPtr64(HandleRef hWnd, int nIndex);
 
        //SetWindowLong won't work correctly for 64-bit: we should use SetWindowLongPtr instead.  On
        //32-bit, SetWindowLongPtr is just #defined as SetWindowLong.  SetWindowLong really should 
        //take/return int instead of IntPtr/HandleRef, but since we're running this only for 32-bit
        //it'll be OK.
        public static IntPtr SetWindowLong(HandleRef hWnd, int nIndex, HandleRef dwNewLong) 
        {
            if (IntPtr.Size == 4)
            {
                return SetWindowLongPtr32(hWnd, nIndex, dwNewLong);
            }
            return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
        }
        [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")]
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLong")]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetWindowLongPtr32(HandleRef hWnd, int nIndex, HandleRef dwNewLong);
        [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")]
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLongPtr")]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetWindowLongPtr64(HandleRef hWnd, int nIndex, HandleRef dwNewLong);
 
        public static IntPtr SetWindowLong(HandleRef hWnd, int nIndex, NativeMethods.WndProc wndproc)
        {
            if (IntPtr.Size == 4)
            {
                return SetWindowLongPtr32(hWnd, nIndex, wndproc);
            }
            return SetWindowLongPtr64(hWnd, nIndex, wndproc);
        }
        [SuppressMessage("Microsoft.Portability", "CA1901:PInvokeDeclarationsShouldBePortable")]
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLong")]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetWindowLongPtr32(HandleRef hWnd, int nIndex, NativeMethods.WndProc wndproc);
        [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")]
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto, EntryPoint = "SetWindowLongPtr")]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetWindowLongPtr64(HandleRef hWnd, int nIndex, NativeMethods.WndProc wndproc);
 
        [DllImport(ExternDll.Ole32, PreserveSig = false)]
        [ResourceExposure(ResourceScope.None)]
        public static extern UnsafeNativeMethods.ILockBytes CreateILockBytesOnHGlobal(HandleRef hGlobal, bool fDeleteOnRelease);
        [DllImport(ExternDll.Ole32, PreserveSig=false)]
        [ResourceExposure(ResourceScope.None)]
        public static extern UnsafeNativeMethods.IStorage StgCreateDocfileOnILockBytes(UnsafeNativeMethods.ILockBytes iLockBytes, int grfMode, int reserved);
 
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="CreatePopupMenu", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntCreatePopupMenu();
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr CreatePopupMenu() {
            return System.Internal.HandleCollector.Add(IntCreatePopupMenu(), NativeMethods.CommonHandles.Menu);
        }
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool RemoveMenu(HandleRef hMenu, int uPosition, int uFlags);
       
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="DestroyMenu", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern bool IntDestroyMenu(HandleRef hMenu);
        public static bool DestroyMenu(HandleRef hMenu) {
            System.Internal.HandleCollector.Remove((IntPtr)hMenu, NativeMethods.CommonHandles.Menu);
            return IntDestroyMenu(hMenu);
        }
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetForegroundWindow(HandleRef hWnd);
      
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr GetSystemMenu(HandleRef hWnd, bool bRevert);
      
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr DefFrameProc(IntPtr hWnd, IntPtr hWndClient, int msg, IntPtr wParam, IntPtr lParam);
      
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool TranslateMDISysAccel(IntPtr hWndClient, [In, Out] ref NativeMethods.MSG msg);
     
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetLayeredWindowAttributes(HandleRef hwnd, int crKey, byte bAlpha, int dwFlags);
      
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static bool SetMenu(HandleRef hWnd, HandleRef hMenu);
    
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetWindowPlacement(HandleRef hWnd, ref NativeMethods.WINDOWPLACEMENT placement);
 
    
        [DllImport(ExternDll.Kernel32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void GetStartupInfo([In, Out] NativeMethods.STARTUPINFO_I startupinfo_i);
     
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetMenuDefaultItem(HandleRef hwnd, int nIndex, bool pos);
     
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool EnableMenuItem(HandleRef hMenu, int UIDEnabledItem, int uEnable);
    
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr SetActiveWindow(HandleRef hWnd);
 
        [DllImport(ExternDll.Gdi32, SetLastError=true, EntryPoint="CreateIC", CharSet=System.Runtime.InteropServices.CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr IntCreateIC(string lpszDriverName, string lpszDeviceName, string lpszOutput, HandleRef /*DEVMODE*/ lpInitData);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr CreateIC(string lpszDriverName, string lpszDeviceName, string lpszOutput, HandleRef /*DEVMODE*/ lpInitData) {
            return System.Internal.HandleCollector.Add(IntCreateIC(lpszDriverName, lpszDeviceName, lpszOutput, lpInitData), NativeMethods.CommonHandles.HDC);
        }
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ClipCursor(ref NativeMethods.RECT rcClip);
     
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool ClipCursor(NativeMethods.COMRECT rcClip);
     
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr SetCursor(HandleRef hcursor);
     
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetCursorPos(int x, int y);
    
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public extern static int ShowCursor(bool bShow);
    
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="DestroyCursor", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern bool IntDestroyCursor(HandleRef hCurs);
        public static bool DestroyCursor(HandleRef hCurs) {
            System.Internal.HandleCollector.Remove((IntPtr)hCurs, NativeMethods.CommonHandles.Cursor);
            return IntDestroyCursor(hCurs);
        }
        
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool IsWindow(HandleRef hWnd);
    
        [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, EntryPoint="DeleteDC", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        private static extern bool IntDeleteDC(HandleRef hDC);
        public static bool DeleteDC(HandleRef hDC) {
            System.Internal.HandleCollector.Remove((IntPtr)hDC, NativeMethods.CommonHandles.HDC);
            return IntDeleteDC(hDC);
        }
 
        public static bool DeleteCompatibleDC(HandleRef hDC)
        {
            System.Internal.HandleCollector.Remove((IntPtr)hDC, NativeMethods.CommonHandles.CompatibleHDC);
            return IntDeleteDC(hDC);
        }
 
        public const int LAYOUT_RTL = 0x00000001;
        public const int LAYOUT_BITMAPORIENTATIONPRESERVED = 0x00000008;        
 
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Ansi)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetMessageA([In, Out] ref NativeMethods.MSG msg, HandleRef hWnd, int uMsgFilterMin, int uMsgFilterMax);
     
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Unicode)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetMessageW([In, Out] ref NativeMethods.MSG msg, HandleRef hWnd, int uMsgFilterMin, int uMsgFilterMax);
     
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr PostMessage(HandleRef hwnd, int msg, int wparam, int lparam);
 
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr PostMessage(HandleRef hwnd, int msg, int wparam, IntPtr lparam);
    
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetClientRect(HandleRef hWnd, [In, Out] ref NativeMethods.RECT rect);
    
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetClientRect(HandleRef hWnd, IntPtr rect);
    
        [SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
        [DllImport(ExternDll.User32, EntryPoint="WindowFromPoint", ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        private static extern IntPtr _WindowFromPoint(POINTSTRUCT pt);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr WindowFromPoint(int x, int y) {
            POINTSTRUCT ps = new POINTSTRUCT(x, y);
            return _WindowFromPoint(ps);
        }
        [DllImport(ExternDll.User32, SetLastError=true, ExactSpelling = true)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr WindowFromDC( HandleRef hDC );
        [DllImport(ExternDll.User32, EntryPoint="CreateWindowEx", CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr IntCreateWindowEx(int  dwExStyle, string lpszClassName,
                                                   string lpszWindowName, int style, int x, int y, int width, int height,
                                                   HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, [MarshalAs(UnmanagedType.AsAny)] object pvParam);
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static IntPtr CreateWindowEx(int  dwExStyle, string lpszClassName,
                                         string lpszWindowName, int style, int x, int y, int width, int height,
                                         HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, [MarshalAs(UnmanagedType.AsAny)]object pvParam) {
            return IntCreateWindowEx(dwExStyle, lpszClassName,
                                         lpszWindowName, style, x, y, width, height, hWndParent, hMenu,
                                         hInst, pvParam);
        }
        
        [DllImport(ExternDll.User32, ExactSpelling=true, EntryPoint="DestroyWindow", CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool IntDestroyWindow(HandleRef hWnd);
        public static bool DestroyWindow(HandleRef hWnd) {
            return IntDestroyWindow(hWnd);
        }
        
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool UnregisterClass(string className, HandleRef hInstance);
    
        [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.Process)]
        public static extern IntPtr GetStockObject(int nIndex);
     
        [DllImport(ExternDll.User32, CharSet=CharSet.Auto, SetLastError=true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern short RegisterClass(NativeMethods.WNDCLASS_D wc);
   
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void PostQuitMessage(int nExitCode);
    
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern void WaitMessage();
     
        [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetWindowPlacement(HandleRef hWnd, [In] ref NativeMethods.WINDOWPLACEMENT placement);
 
        // This method is not available until Windows 8.1
        [DllImport(ExternDll.User32, ExactSpelling=true, SetLastError = true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern uint GetDpiForWindow(HandleRef hWnd);
 
        // For system power status
        //
        [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool GetSystemPowerStatus([In, Out] ref NativeMethods.SYSTEM_POWER_STATUS systemPowerStatus);
 
        [DllImport(ExternDll.Powrprof, ExactSpelling=true, CharSet=CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetSuspendState(bool hiberate, bool forceCritical, bool disableWakeEvent);
 
        //for RegionData
        [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int GetRegionData(HandleRef hRgn, int size, IntPtr lpRgnData);
 
        public unsafe static NativeMethods.RECT[] GetRectsFromRegion(IntPtr hRgn) {
            NativeMethods.RECT[] regionRects = null;
            IntPtr pBytes = IntPtr.Zero;
            try {
                // see how much memory we need to allocate
                int regionDataSize = GetRegionData(new HandleRef(null, hRgn), 0, IntPtr.Zero);
                if (regionDataSize != 0) {
                    pBytes = Marshal.AllocCoTaskMem(regionDataSize);
                    // get the data
                    int ret = GetRegionData(new HandleRef(null, hRgn), regionDataSize, pBytes);
                    if (ret == regionDataSize) {
                        // cast to the structure
                        NativeMethods.RGNDATAHEADER* pRgnDataHeader = (NativeMethods.RGNDATAHEADER*)pBytes;
                        if (pRgnDataHeader->iType == 1) {    // expecting RDH_RECTANGLES
                            regionRects = new NativeMethods.RECT[pRgnDataHeader->nCount];
 
                            Debug.Assert(regionDataSize == pRgnDataHeader->cbSizeOfStruct + pRgnDataHeader->nCount * pRgnDataHeader->nRgnSize);
                            Debug.Assert(Marshal.SizeOf(typeof(NativeMethods.RECT)) == pRgnDataHeader->nRgnSize || pRgnDataHeader->nRgnSize == 0);
 
                            // use the header size as the offset, and cast each rect in.
                            int rectStart = pRgnDataHeader->cbSizeOfStruct;
                            for (int i = 0; i < pRgnDataHeader->nCount; i++) {
                                // use some fancy pointer math to just copy the rect bits directly into the array.
                                regionRects[i] = *((NativeMethods.RECT*)((byte*)pBytes + rectStart + (Marshal.SizeOf(typeof(NativeMethods.RECT)) * i)));
                            }
                        }
                    }
                }
            }
            finally {
                if (pBytes != IntPtr.Zero) {
                    Marshal.FreeCoTaskMem(pBytes);
                }
            }
            return regionRects;
        }
 
        /* Unused
        // for GetUserNameEx
        public enum EXTENDED_NAME_FORMAT {
            NameUnknown = 0,
            NameFullyQualifiedDN = 1,
            NameSamCompatible = 2,
            NameDisplay = 3,
            NameUniqueId = 6,
            NameCanonical = 7,
            NameUserPrincipal = 8,
            NameCanonicalEx = 9,
            NameServicePrincipal = 10
        }
        */
 
        [ComImport(), Guid("00000122-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleDropTarget {
            [PreserveSig]
            int OleDragEnter(
                [In, MarshalAs(UnmanagedType.Interface)]
                object pDataObj,
                [In, MarshalAs(UnmanagedType.U4)]
                int grfKeyState,
                [In]
                POINTSTRUCT pt,
                [In, Out]
                ref int pdwEffect);
            
            [PreserveSig]
            int OleDragOver(
                [In, MarshalAs(UnmanagedType.U4)]
                int grfKeyState,
                [In]
                POINTSTRUCT pt,
                [In, Out]
                ref int pdwEffect);
            
            [PreserveSig]
            int OleDragLeave();
            
            [PreserveSig]
            int OleDrop(
                [In, MarshalAs(UnmanagedType.Interface)]
                object pDataObj,
                [In, MarshalAs(UnmanagedType.U4)]
                int grfKeyState,
                [In]
                POINTSTRUCT pt,
                [In, Out]
                ref int pdwEffect);
        }
        
        [ComImport(), Guid("00000121-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleDropSource {
            
            [PreserveSig]
            int OleQueryContinueDrag(
                int fEscapePressed,
                [In, MarshalAs(UnmanagedType.U4)]
                int grfKeyState);
 
            [PreserveSig]
            int OleGiveFeedback(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwEffect);
        }
        
        [ComImport(), Guid("00000016-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleMessageFilter {
        
            [PreserveSig]
            int HandleInComingCall(
                int dwCallType,
                IntPtr hTaskCaller,
                int dwTickCount,
                /* LPINTERFACEINFO */ IntPtr lpInterfaceInfo);
 
            [PreserveSig]
            int RetryRejectedCall(
                IntPtr hTaskCallee,
                int dwTickCount,
                int dwRejectType);
            
            [PreserveSig]
            int MessagePending(
                IntPtr hTaskCallee,
                int dwTickCount,
                int dwPendingType);
        }
        
        [
        ComImport(), 
        Guid("B196B289-BAB4-101A-B69C-00AA00341D07"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
        ]
        public interface IOleControlSite {
            
            [PreserveSig]
            int OnControlInfoChanged();
            
            [PreserveSig]
            int LockInPlaceActive(int fLock);
            
            [PreserveSig]
            int GetExtendedControl(
                [Out, MarshalAs(UnmanagedType.IDispatch)]
                out object ppDisp);
            
            [PreserveSig]
            int TransformCoords(
                [In, Out]
                NativeMethods._POINTL pPtlHimetric,
                [In, Out]
                NativeMethods.tagPOINTF pPtfContainer,
                [In, MarshalAs(UnmanagedType.U4)]
                int dwFlags);
            
            [PreserveSig]
            int TranslateAccelerator(
                [In]
                ref NativeMethods.MSG pMsg,
                [In, MarshalAs(UnmanagedType.U4)]
                int grfModifiers);
 
            [PreserveSig]
            int OnFocus(int fGotFocus);
            
            [PreserveSig]
            int ShowPropertyFrame();
 
        }
        
        [ComImport(), Guid("00000118-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleClientSite {
            
            [PreserveSig]
            int SaveObject();
 
            [PreserveSig]
            int GetMoniker(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwAssign,
                [In, MarshalAs(UnmanagedType.U4)]
                int dwWhichMoniker,
                [Out, MarshalAs(UnmanagedType.Interface)]
                out object moniker);
 
            [PreserveSig]
            int GetContainer(out IOleContainer container);
            
            [PreserveSig]
            int ShowObject();
            
            [PreserveSig]
            int OnShowWindow(int fShow);
            
            [PreserveSig]
            int RequestNewObjectLayout();
        }
        
        [ComImport(), Guid("00000119-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleInPlaceSite {
            
            IntPtr GetWindow();
            
            [PreserveSig]
            int ContextSensitiveHelp(int fEnterMode);
            
            [PreserveSig]
            int CanInPlaceActivate();
            
            [PreserveSig]
            int OnInPlaceActivate();
            
            [PreserveSig]
            int OnUIActivate();
            
            [PreserveSig]
            int GetWindowContext(
                [Out, MarshalAs(UnmanagedType.Interface)] 
                out UnsafeNativeMethods.IOleInPlaceFrame ppFrame,
                [Out, MarshalAs(UnmanagedType.Interface)] 
                out UnsafeNativeMethods.IOleInPlaceUIWindow ppDoc,
                [Out] 
                NativeMethods.COMRECT lprcPosRect,
                [Out] 
                NativeMethods.COMRECT lprcClipRect,
                [In, Out] 
                NativeMethods.tagOIFI lpFrameInfo);
            
            [PreserveSig]
            int Scroll(
                NativeMethods.tagSIZE scrollExtant);
            
            [PreserveSig]
            int OnUIDeactivate(
                int fUndoable);
                
            [PreserveSig]
            int OnInPlaceDeactivate();
            
            [PreserveSig]
            int DiscardUndoState();
            
            [PreserveSig]
            int DeactivateAndUndo();
            
            [PreserveSig]
            int OnPosRectChange(
                [In] 
                NativeMethods.COMRECT lprcPosRect);
        }
        
        [ComImport(), Guid("742B0E01-14E6-101B-914E-00AA00300CAB"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface ISimpleFrameSite {
 
            [PreserveSig]
                int PreMessageFilter(
                IntPtr hwnd,
                [In, MarshalAs(UnmanagedType.U4)] 
                int msg,
                IntPtr wp,
                IntPtr lp,
                [In, Out] 
                ref IntPtr plResult,
                [In, Out, MarshalAs(UnmanagedType.U4)] 
                ref int pdwCookie);
            
            [PreserveSig]
            int PostMessageFilter(
                IntPtr hwnd,
                [In, MarshalAs(UnmanagedType.U4)] 
                int msg,
                IntPtr wp,
                IntPtr lp,
                [In, Out] 
                ref IntPtr plResult,
                [In, MarshalAs(UnmanagedType.U4)] 
                int dwCookie);
        }
        
        [ComImport(), Guid("40A050A0-3C31-101B-A82E-08002B2B2337"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IVBGetControl {
        
            [PreserveSig]
            int EnumControls(
                int dwOleContF,
                int dwWhich,
                [Out] 
                out IEnumUnknown ppenum);
        }
        
        [ComImport(), Guid("91733A60-3F4C-101B-A3F6-00AA0034E4E9"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IGetVBAObject {
            
           [PreserveSig]
           int GetObject(
                [In] 
                ref Guid riid,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                IVBFormat[] rval,
                int dwReserved);
        }
        
        [ComImport(), Guid("9BFBBC02-EFF1-101A-84ED-00AA00341D07"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IPropertyNotifySink {
            void OnChanged(int dispID);
            
            [PreserveSig]
            int OnRequestEdit(int dispID);
        }
        
        [ComImport(), Guid("9849FD60-3768-101B-8D72-AE6164FFE3CF"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IVBFormat {
            
            [PreserveSig]
            int Format(
                [In] 
                ref object var,
                IntPtr pszFormat,
                IntPtr lpBuffer,
                short cpBuffer,
                int lcid,
                short firstD,
                short firstW,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                short[] result);
        }
        
        [ComImport(), Guid("00000100-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IEnumUnknown {
                
            [PreserveSig]
            int Next(
                [In, MarshalAs(UnmanagedType.U4)] 
                int celt,
                [Out] 
                IntPtr rgelt,
                IntPtr pceltFetched);
                
            [PreserveSig]
                int Skip(
                [In, MarshalAs(UnmanagedType.U4)] 
                int celt);
                
            void Reset();
            
            void Clone(
                [Out] 
                out IEnumUnknown ppenum);
        }
        
        [ComImport(), Guid("0000011B-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleContainer {
            
            [PreserveSig]
            int ParseDisplayName(
                [In, MarshalAs(UnmanagedType.Interface)] 
                object pbc,
                [In, MarshalAs(UnmanagedType.BStr)] 
                string pszDisplayName,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                int[] pchEaten,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                object[] ppmkOut);
                
            [PreserveSig]
            int EnumObjects(
                [In, MarshalAs(UnmanagedType.U4)] 
                int grfFlags,
                [Out] 
                out IEnumUnknown ppenum);
                
            [PreserveSig]
            int LockContainer(
                bool fLock);
        }
        
        [ComImport(), Guid("00000116-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleInPlaceFrame {
            
            IntPtr GetWindow();
            
            [PreserveSig]
            int ContextSensitiveHelp(int fEnterMode);
            
            [PreserveSig]
            int GetBorder(
                [Out]
                NativeMethods.COMRECT lprectBorder);
            
            [PreserveSig]
            int RequestBorderSpace(
                [In]
                NativeMethods.COMRECT pborderwidths);
            
            [PreserveSig]
            int SetBorderSpace(
                [In]
                NativeMethods.COMRECT pborderwidths);
            
            [PreserveSig]
            int  SetActiveObject(
                [In, MarshalAs(UnmanagedType.Interface)]
                UnsafeNativeMethods.IOleInPlaceActiveObject pActiveObject,
                [In, MarshalAs(UnmanagedType.LPWStr)]
                string pszObjName);
            
            [PreserveSig]
            int InsertMenus(
                [In]
                IntPtr hmenuShared,
                [In, Out]
                NativeMethods.tagOleMenuGroupWidths lpMenuWidths);
            
            [PreserveSig]
            int SetMenu(
                [In]
                IntPtr hmenuShared,
                [In]
                IntPtr holemenu,
                [In]
                IntPtr hwndActiveObject);
            
            [PreserveSig]
            int RemoveMenus(
                [In]
                IntPtr hmenuShared);
            
            [PreserveSig]
            int SetStatusText(
                [In, MarshalAs(UnmanagedType.LPWStr)]
                string pszStatusText);
            
            [PreserveSig]
            int EnableModeless(
                bool fEnable);
            
            [PreserveSig]
                int TranslateAccelerator(
                [In]
                ref NativeMethods.MSG lpmsg,
                [In, MarshalAs(UnmanagedType.U2)]
                short wID);
        }
        
        // Used to control the webbrowser appearance and provide DTE to script via window.external
        [ComVisible(true), ComImport(), Guid("BD3F23C0-D43E-11CF-893B-00AA00BDCE1A"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IDocHostUIHandler {
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int ShowContextMenu(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwID,
                [In]
                NativeMethods.POINT pt,
                [In, MarshalAs(UnmanagedType.Interface)]
                object pcmdtReserved,
                [In, MarshalAs(UnmanagedType.Interface)]
                object pdispReserved);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int GetHostInfo(
                [In, Out]
                NativeMethods.DOCHOSTUIINFO info);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int ShowUI(
                [In, MarshalAs(UnmanagedType.I4)]
                int dwID,
                [In]
                UnsafeNativeMethods.IOleInPlaceActiveObject activeObject,
                [In]
                NativeMethods.IOleCommandTarget commandTarget,
                [In]
                UnsafeNativeMethods.IOleInPlaceFrame frame,
                [In]
                UnsafeNativeMethods.IOleInPlaceUIWindow doc);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int HideUI();
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int UpdateUI();
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int EnableModeless(
                [In, MarshalAs(UnmanagedType.Bool)]
                bool fEnable);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int OnDocWindowActivate(
                [In, MarshalAs(UnmanagedType.Bool)]
                bool fActivate);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int OnFrameWindowActivate(
                [In, MarshalAs(UnmanagedType.Bool)]
                bool fActivate);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int ResizeBorder(
                [In]
                NativeMethods.COMRECT rect,
                [In]
                UnsafeNativeMethods.IOleInPlaceUIWindow doc,
                bool fFrameWindow);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int TranslateAccelerator(
                [In]
                ref NativeMethods.MSG msg,
                [In]
                ref Guid group,
                [In, MarshalAs(UnmanagedType.I4)]
                int nCmdID);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int GetOptionKeyPath(
                [Out, MarshalAs(UnmanagedType.LPArray)]
                String[] pbstrKey,
                [In, MarshalAs(UnmanagedType.U4)]
                int dw);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int GetDropTarget(
                [In, MarshalAs(UnmanagedType.Interface)]
                UnsafeNativeMethods.IOleDropTarget pDropTarget,
                [Out, MarshalAs(UnmanagedType.Interface)]
                out UnsafeNativeMethods.IOleDropTarget ppDropTarget);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int GetExternal(
                [Out, MarshalAs(UnmanagedType.Interface)]
                out object ppDispatch);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int TranslateUrl(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwTranslate,
                [In, MarshalAs(UnmanagedType.LPWStr)]
                string strURLIn,
                [Out, MarshalAs(UnmanagedType.LPWStr)]
                out string pstrURLOut);
 
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int FilterDataObject(
                IComDataObject pDO,
                out IComDataObject ppDORet);
        }
 
        [SuppressUnmanagedCodeSecurity, ComImport(), Guid("D30C1661-CDAF-11d0-8A3E-00C04FC9E26E"),
        TypeLibType(TypeLibTypeFlags.FHidden | TypeLibTypeFlags.FDual | TypeLibTypeFlags.FOleAutomation)]
        public interface IWebBrowser2 {
            //
            // IWebBrowser members
            [DispId(100)] void GoBack();
            [DispId(101)] void GoForward();
            [DispId(102)] void GoHome();
            [DispId(103)] void GoSearch();
            [DispId(104)] 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(105)] void Refresh2([In] ref object level);
            [DispId(106)] void Stop();
            [DispId(200)] object Application {[return: MarshalAs(UnmanagedType.IDispatch)]get;}
            [DispId(201)] object Parent {[return: MarshalAs(UnmanagedType.IDispatch)]get;}
            [DispId(202)] object Container {[return: MarshalAs(UnmanagedType.IDispatch)]get;}
            [DispId(203)] object Document {[return: MarshalAs(UnmanagedType.IDispatch)]get;}
            [DispId(204)] bool TopLevelContainer {get;}
            [DispId(205)] string Type {get;}
            [DispId(206)] int Left {get; set;}
            [DispId(207)] int Top {get; set;}
            [DispId(208)] int Width {get; set;}
            [DispId(209)] int Height {get; set;}
            [DispId(210)] string LocationName {get;}
            [DispId(211)] string LocationURL {get;}
            [DispId(212)] bool Busy {get;}
            //
            // IWebBrowserApp members
            [DispId(300)] void Quit();
            [DispId(301)] void ClientToWindow([Out]out int pcx, [Out]out int pcy);
            [DispId(302)] void PutProperty([In] string property, [In] object vtValue);
            [DispId(303)] object GetProperty([In] string property);
            [DispId(0)] string Name {get;}
            [DispId(-515)] int HWND {get;}
            [DispId(400)] string FullName {get;}
            [DispId(401)] string Path {get;}
            [DispId(402)] bool Visible {get; set;}
            [DispId(403)] bool StatusBar {get; set;}
            [DispId(404)] string StatusText {get; set;}
            [DispId(405)] int ToolBar {get; set;}
            [DispId(406)] bool MenuBar {get; set;}
            [DispId(407)] bool FullScreen {get; set;}
            //
            // IWebBrowser2 members
            [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(501)] NativeMethods.OLECMDF QueryStatusWB([In] NativeMethods.OLECMDID cmdID);
            [DispId(502)] void ExecWB([In] NativeMethods.OLECMDID cmdID,
                    [In] NativeMethods.OLECMDEXECOPT cmdexecopt,
                    ref object pvaIn,
                    IntPtr pvaOut);
            [DispId(503)] void ShowBrowserBar([In] ref object pvaClsid, [In] ref object pvarShow,
                    [In] ref object pvarSize);
            [DispId(-525)] WebBrowserReadyState ReadyState {get;}
            [DispId(550)] bool Offline {get; set;}
            [DispId(551)] bool Silent {get; set;}
            [DispId(552)] bool RegisterAsBrowser {get; set;}
            [DispId(553)] bool RegisterAsDropTarget {get; set;}
            [DispId(554)] bool TheaterMode {get; set;}
            [DispId(555)] bool AddressBar {get; set;}
            [DispId(556)] bool Resizable {get; set;}
        }
 
        [ComImport(), Guid("34A715A0-6587-11D0-924A-0020AFC7AC4D"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DWebBrowserEvents2 {
            [DispId(102)] void StatusTextChange([In] string text);
            [DispId(108)] void ProgressChange([In] int progress, [In] int progressMax);
            [DispId(105)] void CommandStateChange([In] long command, [In] bool enable);
            [DispId(106)] void DownloadBegin();
            [DispId(104)] void DownloadComplete();
            [DispId(113)] void TitleChange([In] string text);
            [DispId(112)] void PropertyChange([In] string szProperty);
            [DispId(250)] void BeforeNavigate2([In, MarshalAs(UnmanagedType.IDispatch)] object pDisp,
                                 [In] ref object URL, [In] ref object flags,
                                 [In] ref object targetFrameName, [In] ref object postData,
                                 [In] ref object headers, [In, Out] ref bool cancel);
            [DispId(251)] void NewWindow2([In, Out, MarshalAs(UnmanagedType.IDispatch)] ref object pDisp,
                                [In, Out] ref bool cancel);
            [DispId(252)] void NavigateComplete2([In, MarshalAs(UnmanagedType.IDispatch)] object pDisp,
                                [In] ref object URL);
            [DispId(259)] void DocumentComplete([In, MarshalAs(UnmanagedType.IDispatch)] object pDisp,
                                [In] ref object URL);
            [DispId(253)] void OnQuit();
            [DispId(254)] void OnVisible([In] bool visible);
            [DispId(255)] void OnToolBar([In] bool toolBar);
            [DispId(256)] void OnMenuBar([In] bool menuBar);
            [DispId(257)] void OnStatusBar([In] bool statusBar);
            [DispId(258)] void OnFullScreen([In] bool fullScreen);
            [DispId(260)] void OnTheaterMode([In] bool theaterMode);
            [DispId(262)] void WindowSetResizable([In] bool resizable);
            [DispId(264)] void WindowSetLeft([In] int left);
            [DispId(265)] void WindowSetTop([In] int top);
            [DispId(266)] void WindowSetWidth([In] int width);
            [DispId(267)] void WindowSetHeight([In] int height);
            [DispId(263)] void WindowClosing([In] bool isChildWindow, [In, Out] ref bool cancel);
            [DispId(268)] void ClientToHostWindow([In, Out] ref long cx, [In, Out] ref long cy);
            [DispId(269)] void SetSecureLockIcon([In] int secureLockIcon);
            [DispId(270)] void FileDownload([In, Out] ref bool cancel);
            [DispId(271)] void NavigateError([In, MarshalAs(UnmanagedType.IDispatch)] object pDisp,
                    [In] ref object URL, [In] ref object frame, [In] ref object statusCode, [In, Out] ref bool cancel);
            [DispId(225)] void PrintTemplateInstantiation([In, MarshalAs(UnmanagedType.IDispatch)] object pDisp);
            [DispId(226)] void PrintTemplateTeardown([In, MarshalAs(UnmanagedType.IDispatch)] object pDisp);
            [DispId(227)] void UpdatePageStatus([In, MarshalAs(UnmanagedType.IDispatch)] object pDisp,
                    [In] ref object nPage, [In] ref object fDone);
            [DispId(272)] void PrivacyImpactedStateChange([In] bool bImpacted);
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("626FC520-A41E-11cf-A731-00A0C9082637"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLDocument {
            [return: MarshalAs(UnmanagedType.IDispatch)] object GetScript();
        }
        
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("332C4425-26CB-11D0-B483-00C04FD90119"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLDocument2 {
            [return: MarshalAs(UnmanagedType.IDispatch)] object GetScript();
            IHTMLElementCollection GetAll();
            IHTMLElement GetBody();
            IHTMLElement GetActiveElement();
            IHTMLElementCollection GetImages();
            IHTMLElementCollection GetApplets();
            IHTMLElementCollection GetLinks();
            IHTMLElementCollection GetForms();
            IHTMLElementCollection GetAnchors();
            void SetTitle(string p);
            string GetTitle();
            IHTMLElementCollection GetScripts();
            void SetDesignMode(string p);
            string GetDesignMode();
            [return: MarshalAs(UnmanagedType.Interface)] object GetSelection();
            string GetReadyState();
            [return: MarshalAs(UnmanagedType.Interface)] object GetFrames();
            IHTMLElementCollection GetEmbeds();
            IHTMLElementCollection GetPlugins();
            void SetAlinkColor(object c);
            object GetAlinkColor();
            void SetBgColor(object c);
            object GetBgColor();
            void SetFgColor(object c);
            object GetFgColor();
            void SetLinkColor(object c);
            object GetLinkColor();
            void SetVlinkColor(object c);
            object GetVlinkColor();
            string GetReferrer();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLLocation GetLocation();
            string GetLastModified();
            void SetUrl(string p);
            string GetUrl();
            void SetDomain(string p);
            string GetDomain();
            void SetCookie(string p);
            string GetCookie();
            void SetExpando(bool p);
            bool GetExpando();
            void SetCharset(string p);
            string GetCharset();
            void SetDefaultCharset(string p);
            string GetDefaultCharset();
            string GetMimeType();
            string GetFileSize();
            string GetFileCreatedDate();
            string GetFileModifiedDate();
            string GetFileUpdatedDate();
            string GetSecurity();
            string GetProtocol();
            string GetNameProp();
            int Write([In, MarshalAs(UnmanagedType.SafeArray)] object[] psarray);
            int WriteLine([In, MarshalAs(UnmanagedType.SafeArray)] object[] psarray);
            [return: MarshalAs(UnmanagedType.Interface)] object Open(string mimeExtension, object name, object features, object replace);
            void Close();
            void Clear();
            bool QueryCommandSupported(string cmdID);
            bool QueryCommandEnabled(string cmdID);
            bool QueryCommandState(string cmdID);
            bool QueryCommandIndeterm(string cmdID);
            string QueryCommandText(
                    string cmdID);
            Object QueryCommandValue(string cmdID);
            bool ExecCommand(string cmdID,
                    bool showUI, Object value);
            bool ExecCommandShowHelp(string cmdID);
            IHTMLElement CreateElement(string eTag);
            void SetOnhelp(Object p);
            Object GetOnhelp();
            void SetOnclick(Object p);
            Object GetOnclick();
            void SetOndblclick(Object p);
            Object GetOndblclick();
            void SetOnkeyup(Object p);
            Object GetOnkeyup();
            void SetOnkeydown(Object p);
            Object GetOnkeydown();
            void SetOnkeypress(Object p);
            Object GetOnkeypress();
            void SetOnmouseup(Object p);
            Object GetOnmouseup();
            void SetOnmousedown(Object p);
            Object GetOnmousedown();
            void SetOnmousemove(Object p);
            Object GetOnmousemove();
            void SetOnmouseout(Object p);
            Object GetOnmouseout();
            void SetOnmouseover(Object p);
            Object GetOnmouseover();
            void SetOnreadystatechange(Object p);
            Object GetOnreadystatechange();
            void SetOnafterupdate(Object p);
            Object GetOnafterupdate();
            void SetOnrowexit(Object p);
            Object GetOnrowexit();
            void SetOnrowenter(Object p);
            Object GetOnrowenter();
            void SetOndragstart(Object p);
            Object GetOndragstart();
            void SetOnselectstart(Object p);
            Object GetOnselectstart();
            IHTMLElement ElementFromPoint(int x, int y);
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLWindow2 GetParentWindow();
            [return: MarshalAs(UnmanagedType.Interface)] object GetStyleSheets();
            void SetOnbeforeupdate(Object p);
            Object GetOnbeforeupdate();
            void SetOnerrorupdate(Object p);
            Object GetOnerrorupdate();
            string toString();
            [return: MarshalAs(UnmanagedType.Interface)] object CreateStyleSheet(string bstrHref,int lIndex);
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050F485-98B5-11CF-BB82-00AA00BDCE0B"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLDocument3 {
            void ReleaseCapture();
            void Recalc([In] bool fForce);
            object CreateTextNode([In] string text);
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement GetDocumentElement();
            string GetUniqueID();
            bool AttachEvent([In] string ev, [In, MarshalAs(UnmanagedType.IDispatch)] object pdisp);
            void DetachEvent([In] string ev, [In, MarshalAs(UnmanagedType.IDispatch)] object pdisp);
            void SetOnrowsdelete([In] Object p);
            Object GetOnrowsdelete();
            void SetOnrowsinserted([In] Object p);
            Object GetOnrowsinserted();
            void SetOncellchange([In] Object p);
            Object GetOncellchange();
            void SetOndatasetchanged([In] Object p);
            Object GetOndatasetchanged();
            void SetOndataavailable([In] Object p);
            Object GetOndataavailable();
            void SetOndatasetcomplete([In] Object p);
            Object GetOndatasetcomplete();
            void SetOnpropertychange([In] Object p);
            Object GetOnpropertychange();
            void SetDir([In] string p);
            string GetDir();
            void SetOncontextmenu([In] Object p);
            Object GetOncontextmenu();
            void SetOnstop([In] Object p);
            Object GetOnstop();
            object CreateDocumentFragment();
            object GetParentDocument();
            void SetEnableDownload([In] bool p);
            bool GetEnableDownload();
            void SetBaseUrl([In] string p);
            string GetBaseUrl();
            [return: MarshalAs(UnmanagedType.IDispatch)] object GetChildNodes();
            void SetInheritStyleSheets([In] bool p);
            bool GetInheritStyleSheets();
            void SetOnbeforeeditfocus([In] Object p);
            Object GetOnbeforeeditfocus();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElementCollection GetElementsByName([In] string v);
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement GetElementById([In] string v);
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElementCollection GetElementsByTagName([In] string v);
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050F69A-98B5-11CF-BB82-00AA00BDCE0B"),
        InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLDocument4 {
            void Focus();
            bool HasFocus();
            void SetOnselectionchange(object p);
            object GetOnselectionchange();
            object GetNamespaces();
            object createDocumentFromUrl(string bstrUrl, string bstrOptions);
            void SetMedia(string bstrMedia);
            string GetMedia();
            object CreateEventObject([In, Optional] ref object eventObject);
            bool FireEvent(string eventName);
            object CreateRenderStyle(string bstr);
            void SetOncontrolselect(object p);
            object GetOncontrolselect();
            string GetURLUnencoded();
        }
        
 
        [ComImport(), Guid("3050f613-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLDocumentEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)] bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1026)] bool onstop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1027)] void onbeforeeditfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1037)] void onselectionchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("332C4426-26CB-11D0-B483-00C04FD90119"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLFramesCollection2 {
            object Item(ref object idOrName);
            int GetLength();
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("332C4427-26CB-11D0-B483-00C04FD90119"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        public interface IHTMLWindow2 {
            [return: MarshalAs(UnmanagedType.IDispatch)] object Item([In] ref object pvarIndex);
            int GetLength();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLFramesCollection2 GetFrames();
            void SetDefaultStatus([In] string p);
            string GetDefaultStatus();
            void SetStatus([In] string p);
            string GetStatus();
            int SetTimeout([In] string expression, [In] int msec, [In] ref Object language);
            void ClearTimeout([In] int timerID);
            void Alert([In] string message);
            bool Confirm([In] string message);
            [return: MarshalAs(UnmanagedType.Struct)] object Prompt([In] string message, [In] string defstr);
            object GetImage();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLLocation GetLocation();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IOmHistory GetHistory();
            void Close();
            void SetOpener([In] object p);
            [return: MarshalAs(UnmanagedType.IDispatch)] object GetOpener();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IOmNavigator GetNavigator();
            void SetName([In] string p);
            string GetName();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLWindow2 GetParent();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLWindow2 Open([In] string URL, [In] string name, [In] string features, [In] bool replace);
            object GetSelf();
            object GetTop();
            object GetWindow();
            void Navigate([In] string URL);
            void SetOnfocus([In] Object p);
            Object GetOnfocus();
            void SetOnblur([In] Object p);
            Object GetOnblur();
            void SetOnload([In] Object p);
            Object GetOnload();
            void SetOnbeforeunload(Object p);
            Object GetOnbeforeunload();
            void SetOnunload([In] Object p);
            Object GetOnunload();
            void SetOnhelp(Object p);
            Object GetOnhelp();
            void SetOnerror([In] Object p);
            Object GetOnerror();
            void SetOnresize([In] Object p);
            Object GetOnresize();
            void SetOnscroll([In] Object p);
            Object GetOnscroll();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLDocument2 GetDocument();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLEventObj GetEvent();
            object Get_newEnum();
            Object ShowModalDialog([In] string dialog, [In] ref Object varArgIn, [In] ref Object varOptions);
            void ShowHelp([In] string helpURL, [In] Object helpArg, [In] string features);
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLScreen GetScreen();
            object GetOption();
            void Focus();
            bool GetClosed();
            void Blur();
            void Scroll([In] int x, [In] int y);
            object GetClientInformation();
            int SetInterval([In] string expression, [In] int msec, [In] ref Object language);
            void ClearInterval([In] int timerID);
            void SetOffscreenBuffering([In] Object p);
            Object GetOffscreenBuffering();
            [return: MarshalAs(UnmanagedType.Struct)] Object ExecScript([In] string code, [In] string language);
            string toString();
            void ScrollBy([In] int x, [In] int y);
            void ScrollTo([In] int x, [In] int y);
            void MoveTo([In] int x, [In] int y);
            void MoveBy([In] int x, [In] int y);
            void ResizeTo([In] int x, [In] int y);
            void ResizeBy([In] int x, [In] int y);
            object GetExternal();
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f4ae-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        public interface IHTMLWindow3 {
            int GetScreenLeft();
            int GetScreenTop();
            bool AttachEvent(string ev, [In, MarshalAs(UnmanagedType.IDispatch)] object pdisp);
            void DetachEvent(string ev, [In, MarshalAs(UnmanagedType.IDispatch)] object pdisp);
            int SetTimeout([In]ref object expression, int msec, [In] ref object language);
            int SetInterval([In]ref object expression, int msec, [In] ref object language);
            void Print();
            void SetBeforePrint(object o);
            object GetBeforePrint();
            void SetAfterPrint(object o);
            object GetAfterPrint();
            object GetClipboardData();
            object ShowModelessDialog(string url, object varArgIn, object options);
        }
        
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f6cf-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        public interface IHTMLWindow4 {
            [return: MarshalAs(UnmanagedType.IDispatch)] object CreatePopup([In] ref object reserved);
            [return: MarshalAs(UnmanagedType.Interface)] object frameElement();
        }
 
        
        [ComImport(), Guid("3050f625-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLWindowEvents2 {
            [DispId(1003)] void onload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1008)] void onunload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1002)] bool onerror(string description, string url, int line);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1017)] void onbeforeunload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1024)] void onbeforeprint(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1025)] void onafterprint(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f666-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        public interface IHTMLPopup {
            void show(int x, int y, int w, int h, ref object element);
            void hide();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLDocument GetDocument();
            bool IsOpen();
        }
        
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f35c-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        public interface IHTMLScreen {
            int GetColorDepth();
            void SetBufferDepth(int d);
            int GetBufferDepth();
            int GetWidth();
            int GetHeight();
            void SetUpdateInterval(int i);
            int GetUpdateInterval();
            int GetAvailHeight();
            int GetAvailWidth();
            bool GetFontSmoothingEnabled();
        }
 
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("163BB1E0-6E00-11CF-837A-48DC04C10000"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLLocation {
            void SetHref([In] string p);
            string GetHref();
            void SetProtocol([In] string p);
            string GetProtocol();
            void SetHost([In] string p);
            string GetHost();
            void SetHostname([In] string p);
            string GetHostname();
            void SetPort([In] string p);
            string GetPort();
            void SetPathname([In] string p);
            string GetPathname();
            void SetSearch([In] string p);
            string GetSearch();
            void SetHash([In] string p);
            string GetHash();
            void Reload([In] bool flag);
            void Replace([In] string bstr);
            void Assign([In] string bstr);
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("FECEAAA2-8405-11CF-8BA1-00AA00476DA6"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IOmHistory {
            short GetLength();
            void Back();
            void Forward();
            void Go([In] ref Object pvargdistance);
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("FECEAAA5-8405-11CF-8BA1-00AA00476DA6"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IOmNavigator {
            string GetAppCodeName();
            string GetAppName();
            string GetAppVersion();
            string GetUserAgent();
            bool JavaEnabled();
            bool TaintEnabled();
            object GetMimeTypes();
            object GetPlugins();
            bool GetCookieEnabled();
            object GetOpsProfile();
            string GetCpuClass();
            string GetSystemLanguage();
            string GetBrowserLanguage();
            string GetUserLanguage();
            string GetPlatform();
            string GetAppMinorVersion();
            int GetConnectionSpeed();
            bool GetOnLine();
            object GetUserProfile();
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050F32D-98B5-11CF-BB82-00AA00BDCE0B"),
        InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLEventObj {
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement GetSrcElement();
            bool GetAltKey();
            bool GetCtrlKey();
            bool GetShiftKey();
            void SetReturnValue(object p);
            object GetReturnValue();
            void SetCancelBubble(bool p);
            bool GetCancelBubble();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement GetFromElement();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement GetToElement();
            void SetKeyCode([In] int p);
            int GetKeyCode();
            int GetButton();
            string GetEventType();
            string GetQualifier();
            int GetReason();
            int GetX();
            int GetY();
            int GetClientX();
            int GetClientY();
            int GetOffsetX();
            int GetOffsetY();
            int GetScreenX();
            int GetScreenY();
            object GetSrcFilter();
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f48B-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLEventObj2 {
            void SetAttribute(string attributeName, object attributeValue, int lFlags);
            object GetAttribute(string attributeName, int lFlags);
            bool RemoveAttribute(string attributeName, int lFlags);
            void SetPropertyName(string name);
            string GetPropertyName();
            void SetBookmarks(ref object bm);
            object GetBookmarks();
            void SetRecordset(ref object rs);
            object GetRecordset();
            void SetDataFld(string df);
            string GetDataFld();
            void SetBoundElements(ref object be);
            object GetBoundElements();
            void SetRepeat(bool r);
            bool GetRepeat();
            void SetSrcUrn(string urn);
            string GetSrcUrn();
            void SetSrcElement(ref object se);
            object GetSrcElement();
            void SetAltKey(bool alt);
            bool GetAltKey();
            void SetCtrlKey(bool ctrl);
            bool GetCtrlKey();
            void SetShiftKey(bool shift);
            bool GetShiftKey();
            void SetFromElement(ref object element);
            object GetFromElement();
            void SetToElement(ref object element);
            object GetToElement();
            void SetButton(int b);
            int GetButton();
            void SetType(string type);
            string GetType();
            void SetQualifier(string q);
            string GetQualifier();
            void SetReason(int r);
            int GetReason();
            void SetX(int x);
            int GetX();
            void SetY(int y);
            int GetY();
            void SetClientX(int x);
            int GetClientX();
            void SetClientY(int y);
            int GetClientY();
            void SetOffsetX(int x);
            int GetOffsetX();
            void SetOffsetY(int y);
            int GetOffsetY();
            void SetScreenX(int x);
            int GetScreenX();
            void SetScreenY(int y);
            int GetScreenY();
            void SetSrcFilter(ref object filter);
            object GetSrcFilter();
            object GetDataTransfer();
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f814-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLEventObj4 {
            int GetWheelDelta();
        };
        
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050F21F-98B5-11CF-BB82-00AA00BDCE0B"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLElementCollection {
            string toString();
            void SetLength(int p);
            int GetLength();
            [return: MarshalAs(UnmanagedType.Interface)] object Get_newEnum();
            [return: MarshalAs(UnmanagedType.IDispatch)] object Item(object idOrName, object index);
            [return: MarshalAs(UnmanagedType.Interface)] object Tags(object tagName);
        }
        
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050F1FF-98B5-11CF-BB82-00AA00BDCE0B"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLElement {
            void SetAttribute(string attributeName, object attributeValue, int lFlags);
            object GetAttribute(string attributeName, int lFlags);
            bool RemoveAttribute(string strAttributeName, int lFlags);
            void SetClassName(string p);
            string GetClassName();
            void SetId(string p);
            string GetId();
            string GetTagName();
            IHTMLElement GetParentElement();
            IHTMLStyle GetStyle();
            void SetOnhelp(Object p);
            Object GetOnhelp();
            void SetOnclick(Object p);
            Object GetOnclick();
            void SetOndblclick(Object p);
            Object GetOndblclick();
            void SetOnkeydown(Object p);
            Object GetOnkeydown();
            void SetOnkeyup(Object p);
            Object GetOnkeyup();
            void SetOnkeypress(Object p);
            Object GetOnkeypress();
            void SetOnmouseout(Object p);
            Object GetOnmouseout();
            void SetOnmouseover(Object p);
            Object GetOnmouseover();
            void SetOnmousemove(Object p);
            Object GetOnmousemove();
            void SetOnmousedown(Object p);
            Object GetOnmousedown();
            void SetOnmouseup(Object p);
            Object GetOnmouseup();
            [return: MarshalAs(UnmanagedType.Interface)] IHTMLDocument2 GetDocument();
            void SetTitle(string p);
            string GetTitle();
            void SetLanguage(string p);
            string GetLanguage();
            void SetOnselectstart(Object p);
            Object GetOnselectstart();
            void ScrollIntoView(object varargStart);
            bool Contains(IHTMLElement pChild);
            int GetSourceIndex();
            Object GetRecordNumber();
            void SetLang(string p);
            string GetLang();
            int GetOffsetLeft();
            int GetOffsetTop();
            int GetOffsetWidth();
            int GetOffsetHeight();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement GetOffsetParent();
            void SetInnerHTML(string p);
            string GetInnerHTML();
            void SetInnerText(string p);
            string GetInnerText();
            void SetOuterHTML(string p);
            string GetOuterHTML();
            void SetOuterText(string p);
            string GetOuterText();
            void InsertAdjacentHTML(string @where,
                string html);
            void InsertAdjacentText(string @where,
                string text);
            IHTMLElement GetParentTextEdit();
            bool GetIsTextEdit();
            void Click();
            [return: MarshalAs(UnmanagedType.Interface)] object GetFilters();
            void SetOndragstart(Object p);
            Object GetOndragstart();
            string toString();
            void SetOnbeforeupdate(Object p);
            Object GetOnbeforeupdate();
            void SetOnafterupdate(Object p);
            Object GetOnafterupdate();
            void SetOnerrorupdate(Object p);
            Object GetOnerrorupdate();
            void SetOnrowexit(Object p);
            Object GetOnrowexit();
            void SetOnrowenter(Object p);
            Object GetOnrowenter();
            void SetOndatasetchanged(Object p);
            Object GetOndatasetchanged();
            void SetOndataavailable(Object p);
            Object GetOndataavailable();
            void SetOndatasetcomplete(Object p);
            Object GetOndatasetcomplete();
            void SetOnfilterchange(Object p);
            Object GetOnfilterchange();
            [return: MarshalAs(UnmanagedType.IDispatch)] object GetChildren();
            [return: MarshalAs(UnmanagedType.IDispatch)] object GetAll();
        }
        
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f434-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLElement2 {
            string ScopeName();
            void SetCapture(bool containerCapture);
            void ReleaseCapture();
            void SetOnLoseCapture(object v);
            object GetOnLoseCapture();
            string GetComponentFromPoint(int x, int y);
            void DoScroll(object component);
            void SetOnScroll(object v);
            object GetOnScroll();
            void SetOnDrag(object v);
            object GetOnDrag();
            void SetOnDragEnd(object v);
            object GetOnDragEnd();
            void SetOnDragEnter(object v);
            object GetOnDragEnter();
            void SetOnDragOver(object v);
            object GetOnDragOver();
            void SetOnDragleave(object v);
            object GetOnDragLeave();
            void SetOnDrop(object v);
            object GetOnDrop();
            void SetOnBeforeCut(object v);
            object GetOnBeforeCut();
            void SetOnCut(object v);
            object GetOnCut();
            void SetOnBeforeCopy(object v);
            object GetOnBeforeCopy();
            void SetOnCopy(object v);
            object GetOnCopy(object p);
            void SetOnBeforePaste(object v);
            object GetOnBeforePaste(object p);
            void SetOnPaste(object v);
            object GetOnPaste(object p);
            object GetCurrentStyle();
            void SetOnPropertyChange(object v);
            object GetOnPropertyChange(object p);
            object GetClientRects();
            object GetBoundingClientRect();
            void SetExpression(string propName, string expression, string language);
            object GetExpression(string propName);
            bool RemoveExpression(string propName);
            void SetTabIndex(int v);
            short GetTabIndex();
            void Focus();
            void SetAccessKey(string v);
            string GetAccessKey();
            void SetOnBlur(object v);
            object GetOnBlur();
            void SetOnFocus(object v);
            object GetOnFocus();
            void SetOnResize(object v);
            object GetOnResize();
            void Blur();
            void AddFilter(object pUnk);
            void RemoveFilter(object pUnk);
            int ClientHeight();
            int ClientWidth();
            int ClientTop();
            int ClientLeft();
            bool AttachEvent(string ev, [In, MarshalAs(UnmanagedType.IDispatch)] object pdisp);
            void DetachEvent(string ev, [In, MarshalAs(UnmanagedType.IDispatch)] object pdisp);
            object ReadyState();
            void SetOnReadyStateChange(object v);
            object GetOnReadyStateChange();
            void SetOnRowsDelete(object v);
            object GetOnRowsDelete();
            void SetOnRowsInserted(object v);
            object GetOnRowsInserted();
            void SetOnCellChange(object v);
            object GetOnCellChange();
            void SetDir(string v);
            string GetDir();
            object CreateControlRange();
            int GetScrollHeight();
            int GetScrollWidth();
            void SetScrollTop(int v);
            int GetScrollTop();
            void SetScrollLeft(int v);
            int GetScrollLeft();
            void ClearAttributes();
            void MergeAttributes(object mergeThis);
            void SetOnContextMenu(object v);
            object GetOnContextMenu();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement
                InsertAdjacentElement(string @where,
                    [In, MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement insertedElement);
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement
                applyElement([In, MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElement apply,
                    string @where);
            string GetAdjacentText(string @where);
            string ReplaceAdjacentText(string @where,string newText);
            bool CanHaveChildren();
            int AddBehavior(string url, ref object oFactory);
            bool RemoveBehavior(int cookie);
            object GetRuntimeStyle();
            object GetBehaviorUrns();
            void SetTagUrn(string v);
            string GetTagUrn();
            void SetOnBeforeEditFocus(object v);
            object GetOnBeforeEditFocus();
            int GetReadyStateValue();
            [return: MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IHTMLElementCollection GetElementsByTagName(string v);
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f673-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLElement3 {
            void MergeAttributes(object mergeThis, object pvarFlags);
            bool IsMultiLine();
            bool CanHaveHTML();
            void SetOnLayoutComplete(object v);
            object GetOnLayoutComplete();
            void SetOnPage(object v);
            object GetOnPage();
            void SetInflateBlock(bool v);
            bool GetInflateBlock();
            void SetOnBeforeDeactivate(object v);
            object GetOnBeforeDeactivate();
            void SetActive();
            void SetContentEditable(string v);
            string GetContentEditable();
            bool IsContentEditable();
            void SetHideFocus(bool v);
            bool GetHideFocus();
            void SetDisabled(bool v);
            bool GetDisabled();
            bool IsDisabled();
            void SetOnMove(object v);
            object GetOnMove();
            void SetOnControlSelect(object v);
            object GetOnControlSelect();
            bool FireEvent(string bstrEventName, IntPtr pvarEventObject);
            void SetOnResizeStart(object v);
            object GetOnResizeStart();
            void SetOnResizeEnd(object v);
            object GetOnResizeEnd();
            void SetOnMoveStart(object v);
            object GetOnMoveStart();
            void SetOnMoveEnd(object v);
            object GetOnMoveEnd();
            void SetOnMouseEnter(object v);
            object GetOnMouseEnter();
            void SetOnMouseLeave(object v);
            object GetOnMouseLeave();
            void SetOnActivate(object v);
            object GetOnActivate();
            void SetOnDeactivate(object v);
            object GetOnDeactivate();
            bool DragDrop();
            int GlyphMode();
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050f5da-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        public interface IHTMLDOMNode {
            long GetNodeType();
            IHTMLDOMNode GetParentNode();
            bool HasChildNodes();
            object GetChildNodes();
            object GetAttributes();
            IHTMLDOMNode InsertBefore(IHTMLDOMNode newChild, object refChild);
            IHTMLDOMNode RemoveChild(IHTMLDOMNode oldChild);
            IHTMLDOMNode ReplaceChild(IHTMLDOMNode newChild, IHTMLDOMNode oldChild);
            IHTMLDOMNode CloneNode(bool fDeep);
            IHTMLDOMNode RemoveNode(bool fDeep);
            IHTMLDOMNode SwapNode(IHTMLDOMNode otherNode);
            IHTMLDOMNode ReplaceNode(IHTMLDOMNode replacement);
            IHTMLDOMNode AppendChild(IHTMLDOMNode newChild);
            string NodeName();
            void SetNodeValue(object v);
            object GetNodeValue();
            IHTMLDOMNode FirstChild();
            IHTMLDOMNode LastChild();
            IHTMLDOMNode PreviousSibling();
            IHTMLDOMNode NextSibling();
        };
        
        [ComImport(), Guid("3050f60f-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f610-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLAnchorEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f611-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLAreaEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f617-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLButtonElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f612-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLControlElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f614-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLFormElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1007)] bool onsubmit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1015)] bool onreset(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f7ff-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLFrameSiteEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1003)] void onload(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f616-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLImgEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1003)] void onload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1002)] void onerror(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1000)] void onabort(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f61a-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLInputFileElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412082)] bool onchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412102)] void onselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1003)] void onload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1002)] void onerror(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1000)] void onabort(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f61b-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLInputImageEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412080)] void onload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412083)] void onerror(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412084)] void onabort(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f618-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLInputTextElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1001)] bool onchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1006)] void onselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1003)] void onload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1002)] void onerror(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1001)] void onabort(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f61c-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLLabelEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f61d-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLLinkElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412080)] void onload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412083)] void onerror(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f61e-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLMapEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f61f-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLMarqueeElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412092)] void onbounce(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412086)] void onfinish(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412085)] void onstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f619-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLOptionButtonElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412082)] bool onchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f622-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLSelectElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147412082)] void onchange_void(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f615-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLStyleElementEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1003)] void onload(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1002)] void onerror(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
        
        [ComImport(), Guid("3050f623-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLTableEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [ComImport(), Guid("3050f624-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLTextContainerEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1001)] void onchange_void(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1006)] void onselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
        
        [ComImport(), Guid("3050f621-98b5-11cf-bb82-00aa00bdce0b"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
        TypeLibType(TypeLibTypeFlags.FHidden)]
        public interface DHTMLScriptEvents2 {
            [DispId(-2147418102)] bool onhelp(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-600)] bool onclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-601)] bool ondblclick(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-603)] bool onkeypress(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-602)] void onkeydown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-604)] void onkeyup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418103)] void onmouseout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418104)] void onmouseover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-606)] void onmousemove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-605)] void onmousedown(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-607)] void onmouseup(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418100)] bool onselectstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418095)] void onfilterchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418101)] bool ondragstart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418108)] bool onbeforeupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418107)] void onafterupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418099)]  bool onerrorupdate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418106)] bool onrowexit(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418105)] void onrowenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418098)] void ondatasetchanged(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418097)] void ondataavailable(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418096)] void ondatasetcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418094)] void onlosecapture(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418093)] void onpropertychange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1014)] void onscroll(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418111)] void onfocus(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418112)] void onblur(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1016)] void onresize(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418092)] bool ondrag(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418091)] void ondragend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418090)] bool ondragenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418089)]  bool ondragover(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418088)] void ondragleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418087)] bool ondrop(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418083)] bool onbeforecut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418086)] bool oncut(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418082)] bool onbeforecopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418085)] bool oncopy(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418081)] bool onbeforepaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418084)] bool onpaste(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1023)] bool oncontextmenu(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418080)] void onrowsdelete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418079)] void onrowsinserted(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-2147418078)] void oncellchange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(-609)] void onreadystatechange(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1030)] void onlayoutcomplete(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1031)] void onpage(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1042)] void onmouseenter(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1043)] void onmouseleave(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1044)] void onactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1045)] void ondeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1034)] bool onbeforedeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1047)] bool onbeforeactivate(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1048)] void onfocusin(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1049)] void onfocusout(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1035)] void onmove(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1036)] bool oncontrolselect(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1038)] bool onmovestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1039)] void onmoveend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1040)] bool onresizestart(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1041)] void onresizeend(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1033)] bool onmousewheel(UnsafeNativeMethods.IHTMLEventObj evtObj);
            [DispId(1002)]void onerror(UnsafeNativeMethods.IHTMLEventObj evtObj);
        }
 
        [SuppressUnmanagedCodeSecurity, ComVisible(true), Guid("3050F25E-98B5-11CF-BB82-00AA00BDCE0B"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        internal interface IHTMLStyle {
            void SetFontFamily(string p);
            string GetFontFamily();
            void SetFontStyle(string p);
            string GetFontStyle();
            void SetFontObject(string p);
            string GetFontObject();
            void SetFontWeight(string p);
            string GetFontWeight();
            void SetFontSize(object p);
            object GetFontSize();
            void SetFont(string p);
            string GetFont();
            void SetColor(object p);
            object GetColor();
            void SetBackground(string p);
            string GetBackground();
            void SetBackgroundColor(object p);
            object GetBackgroundColor();
            void SetBackgroundImage(string p);
            string GetBackgroundImage();
            void SetBackgroundRepeat(string p);
            string GetBackgroundRepeat();
            void SetBackgroundAttachment(string p);
            string GetBackgroundAttachment();
            void SetBackgroundPosition(string p);
            string GetBackgroundPosition();
            void SetBackgroundPositionX(object p);
            object GetBackgroundPositionX();
            void SetBackgroundPositionY(object p);
            object GetBackgroundPositionY();
            void SetWordSpacing(object p);
            object GetWordSpacing();
            void SetLetterSpacing(object p);
            object GetLetterSpacing();
            void SetTextDecoration(string p);
            string GetTextDecoration();
            void SetTextDecorationNone(bool p);
            bool GetTextDecorationNone();
            void SetTextDecorationUnderline(bool p);
            bool GetTextDecorationUnderline();
            void SetTextDecorationOverline(bool p);
            bool GetTextDecorationOverline();
            void SetTextDecorationLineThrough(bool p);
            bool GetTextDecorationLineThrough();
            void SetTextDecorationBlink(bool p);
            bool GetTextDecorationBlink();
            void SetVerticalAlign(object p);
            object GetVerticalAlign();
            void SetTextTransform(string p);
            string GetTextTransform();
            void SetTextAlign(string p);
            string GetTextAlign();
            void SetTextIndent(object p);
            object GetTextIndent();
            void SetLineHeight(object p);
            object GetLineHeight();
            void SetMarginTop(object p);
            object GetMarginTop();
            void SetMarginRight(object p);
            object GetMarginRight();
            void SetMarginBottom(object p);
            object GetMarginBottom();
            void SetMarginLeft(object p);
            object GetMarginLeft();
            void SetMargin(string p);
            string GetMargin();
            void SetPaddingTop(object p);
            object GetPaddingTop();
            void SetPaddingRight(object p);
            object GetPaddingRight();
            void SetPaddingBottom(object p);
            object GetPaddingBottom();
            void SetPaddingLeft(object p);
            object GetPaddingLeft();
            void SetPadding(string p);
            string GetPadding();
            void SetBorder(string p);
            string GetBorder();
            void SetBorderTop(string p);
            string GetBorderTop();
            void SetBorderRight(string p);
            string GetBorderRight();
            void SetBorderBottom(string p);
            string GetBorderBottom();
            void SetBorderLeft(string p);
            string GetBorderLeft();
            void SetBorderColor(string p);
            string GetBorderColor();
            void SetBorderTopColor(object p);
            object GetBorderTopColor();
            void SetBorderRightColor(object p);
            object GetBorderRightColor();
            void SetBorderBottomColor(object p);
            object GetBorderBottomColor();
            void SetBorderLeftColor(object p);
            object GetBorderLeftColor();
            void SetBorderWidth(string p);
            string GetBorderWidth();
            void SetBorderTopWidth(object p);
            object GetBorderTopWidth();
            void SetBorderRightWidth(object p);
            object GetBorderRightWidth();
            void SetBorderBottomWidth(object p);
            object GetBorderBottomWidth();
            void SetBorderLeftWidth(object p);
            object GetBorderLeftWidth();
            void SetBorderStyle(string p);
            string GetBorderStyle();
            void SetBorderTopStyle(string p);
            string GetBorderTopStyle();
            void SetBorderRightStyle(string p);
            string GetBorderRightStyle();
            void SetBorderBottomStyle(string p);
            string GetBorderBottomStyle();
            void SetBorderLeftStyle(string p);
            string GetBorderLeftStyle();
            void SetWidth(object p);
            object GetWidth();
            void SetHeight(object p);
            object GetHeight();
            void SetStyleFloat(string p);
            string GetStyleFloat();
            void SetClear(string p);
            string GetClear();
            void SetDisplay(string p);
            string GetDisplay();
            void SetVisibility(string p);
            string GetVisibility();
            void SetListStyleType(string p);
            string GetListStyleType();
            void SetListStylePosition(string p);
            string GetListStylePosition();
            void SetListStyleImage(string p);
            string GetListStyleImage();
            void SetListStyle(string p);
            string GetListStyle();
            void SetWhiteSpace(string p);
            string GetWhiteSpace();
            void SetTop(object p);
            object GetTop();
            void SetLeft(object p);
            object GetLeft();
            string GetPosition();
            void SetZIndex(object p);
            object GetZIndex();
            void SetOverflow(string p);
            string GetOverflow();
            void SetPageBreakBefore(string p);
            string GetPageBreakBefore();
            void SetPageBreakAfter(string p);
            string GetPageBreakAfter();
            void SetCssText(string p);
            string GetCssText();
            void SetPixelTop(int p);
            int GetPixelTop();
            void SetPixelLeft(int p);
            int GetPixelLeft();
            void SetPixelWidth(int p);
            int GetPixelWidth();
            void SetPixelHeight(int p);
            int GetPixelHeight();
            void SetPosTop(float p);
            float GetPosTop();
            void SetPosLeft(float p);
            float GetPosLeft();
            void SetPosWidth(float p);
            float GetPosWidth();
            void SetPosHeight(float p);
            float GetPosHeight();
            void SetCursor(string p);
            string GetCursor();
            void SetClip(string p);
            string GetClip();
            void SetFilter(string p);
            string GetFilter();
            void SetAttribute(string strAttributeName, object AttributeValue, int lFlags);
            object GetAttribute(string strAttributeName, int lFlags);
            bool RemoveAttribute(string strAttributeName, int lFlags);
        }
        
        [ComImport(),
         Guid("39088D7E-B71E-11D1-8F39-00C04FD946D0"),
         InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
        ]
        public interface IExtender {
            
            int Align {get; set;}
            
            bool Enabled {get; set;}
            
            int Height {get; set;}
            
            int Left {get; set;}
            
            bool TabStop {get; set;}
            
            int Top {get; set;}
            
            bool Visible {get; set;}
            
            int Width {get; set;}
            
            string Name {[return: MarshalAs(UnmanagedType.BStr)]get;}
            
            object Parent {[return: MarshalAs(UnmanagedType.Interface)]get;}
            
            IntPtr Hwnd {get;}
            
            object Container {[return: MarshalAs(UnmanagedType.Interface)]get;}
            
            void Move(
                [In, MarshalAs(UnmanagedType.Interface)] 
                object left,
                [In, MarshalAs(UnmanagedType.Interface)] 
                object top,
                [In, MarshalAs(UnmanagedType.Interface)] 
                object width,
                [In, MarshalAs(UnmanagedType.Interface)] 
                object height);
        }
        
        [ComImport(), 
         Guid("8A701DA0-4FEB-101B-A82E-08002B2B2337"), 
         InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
        ]
        public interface IGetOleObject {
            [return: MarshalAs(UnmanagedType.Interface)]
            object GetOleObject(ref Guid riid);
        }
 
        [
            ComImport(),
            Guid("CB2F6722-AB3A-11d2-9C40-00C04FA30A3E"),
            InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
        ] 
        internal interface ICorRuntimeHost { 
 
            [PreserveSig()] int CreateLogicalThreadState();
            [PreserveSig()] int DeleteLogicalThreadState();
            [PreserveSig()] int SwitchInLogicalThreadState(
             [In] ref uint pFiberCookie);                 // [in] Cookie that indicates the fiber to use.
        
            [PreserveSig()] int SwitchOutLogicalThreadState(
             out uint FiberCookie);               // [out] Cookie that indicates the fiber being switched out.
        
            [PreserveSig()] int LocksHeldByLogicalThread(           // Return code.
             out uint pCount                        // [out] Number of locks that the current thread holds.
                );
        
            [PreserveSig()] int MapFile(
             IntPtr          hFile,          // [in]  HANDLE for file
             out IntPtr      hMapAddress);   // [out] HINSTANCE for mapped file
        
            //=================================================================
            //
            // New hosting methods
            //
            // Returns an object for configuring the runtime prior to 
            // it starting. If the runtime has been initialized this
            // routine returns an error. See ICorConfiguration.
            [PreserveSig()] int GetConfiguration([MarshalAs(UnmanagedType.IUnknown)] out object pConfiguration);
        
            // Starts the runtime. This is equivalent to CoInitializeCor();
            [PreserveSig()] int Start();
        
            // Terminates the runtime, This is equivalent CoUninitializeCor();
            [PreserveSig()] int Stop();
        
            // Creates a domain in the runtime. The identity array is 
            // a pointer to an array TYPE containing IIdentity objects defining
            // the security identity.
            [PreserveSig()] int CreateDomain(string pwzFriendlyName,  
                                 [MarshalAs(UnmanagedType.IUnknown)] object pIdentityArray, // Optional
                                 [MarshalAs(UnmanagedType.IUnknown)] out object pAppDomain);
        
            // Returns the default domain.
            [PreserveSig()] int GetDefaultDomain([MarshalAs(UnmanagedType.IUnknown)] out object pAppDomain);
        
        
            // Enumerate currently existing domains. 
            [PreserveSig()] int EnumDomains(out IntPtr hEnum);
        
            // Returns S_FALSE when there are no more domains. A domain
            // is passed out only when S_OK is returned.
            [PreserveSig()] int NextDomain(IntPtr hEnum,
                               [MarshalAs(UnmanagedType.IUnknown)] out object pAppDomain);
        
            // Close the enumeration, releasing resources
            [PreserveSig()] int CloseEnum(IntPtr hEnum);
        
            [PreserveSig()] int CreateDomainEx(string pwzFriendlyName, // Optional  
                                   [MarshalAs(UnmanagedType.IUnknown)] object pSetup,        // Optional
                                   [MarshalAs(UnmanagedType.IUnknown)] object pEvidence,     // Optional
                                   [MarshalAs(UnmanagedType.IUnknown)] out object pAppDomain);
        
            [PreserveSig()] int CreateDomainSetup([MarshalAs(UnmanagedType.IUnknown)] out object pAppDomainSetup);
        
            [PreserveSig()] int CreateEvidence([MarshalAs(UnmanagedType.IUnknown)] out object pEvidence);
        
            [PreserveSig()] int UnloadDomain([MarshalAs(UnmanagedType.IUnknown)] object pAppDomain);
        
            // Returns the thread's domain.
            [PreserveSig()] int CurrentDomain([MarshalAs(UnmanagedType.IUnknown)] out object pAppDomain);
        }
 
        [
            ComImport(),
            Guid("CB2F6723-AB3A-11d2-9C40-00C04FA30A3E")
        ]
        internal class CorRuntimeHost
        {
        }
 
        [ComImport(), 
        Guid("000C0601-0000-0000-C000-000000000046"), 
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
        ]
        public interface IMsoComponentManager {
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.QueryService"]/*' />
        /// <devdoc>
        ///      Return in *ppvObj an implementation of interface iid for service
        ///      guidService (same as IServiceProvider::QueryService).
        ///      Return NOERROR if the requested service is supported, otherwise return
        ///      NULL in *ppvObj and an appropriate error (eg E_FAIL, E_NOINTERFACE).
        /// </devdoc>
        [PreserveSig]
        int QueryService(
            ref Guid guidService,
            ref Guid iid,
            [MarshalAs(UnmanagedType.Interface)] 
            out object ppvObj);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FDebugMessage"]/*' />
        /// <devdoc>
        ///      Standard FDebugMessage method.
        ///      Since IMsoComponentManager is a reference counted interface, 
        ///      MsoDWGetChkMemCounter should be used when processing the 
        ///      msodmWriteBe message.
        /// </devdoc>
        [PreserveSig]
        bool FDebugMessage(
            IntPtr hInst, 
            int msg, 
            IntPtr wParam, 
            IntPtr lParam);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FRegisterComponent"]/*' />
        /// <devdoc>
        ///      Register component piComponent and its registration info pcrinfo with
        ///      this component manager.  Return in *pdwComponentID a cookie which will
        ///      identify the component when it calls other IMsoComponentManager
        ///      methods.
        ///      Return TRUE if successful, FALSE otherwise.
        /// </devdoc>
        [PreserveSig]
        bool FRegisterComponent(
            IMsoComponent component,
            NativeMethods.MSOCRINFOSTRUCT pcrinfo,
            out IntPtr dwComponentID);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FRevokeComponent"]/*' />
        /// <devdoc>
        ///      Undo the registration of the component identified by dwComponentID
        ///      (the cookie returned from the FRegisterComponent method).
        ///      Return TRUE if successful, FALSE otherwise.
        /// </devdoc>
        [PreserveSig]
        bool FRevokeComponent(IntPtr dwComponentID);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FUpdateComponentRegistration"]/*' />
        /// <devdoc>
        ///      Update the registration info of the component identified by
        ///      dwComponentID (the cookie returned from FRegisterComponent) with the
        ///      new registration information pcrinfo.
        ///      Typically this is used to update the idle time registration data, but
        ///      can be used to update other registration data as well.
        ///      Return TRUE if successful, FALSE otherwise.
        /// </devdoc>
        [PreserveSig]
        bool FUpdateComponentRegistration(IntPtr dwComponentID,NativeMethods.MSOCRINFOSTRUCT pcrinfo);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FOnComponentActivate"]/*' />
        /// <devdoc>
        ///      Notify component manager that component identified by dwComponentID
        ///      (cookie returned from FRegisterComponent) has been activated.
        ///      The active component gets the  chance to process messages before they
        ///      are dispatched (via IMsoComponent::FPreTranslateMessage) and typically
        ///      gets first chance at idle time after the host.
        ///      This method fails if another component is already Exclusively Active.
        ///      In this case, FALSE is returned and SetLastError is set to 
        ///      msoerrACompIsXActive (comp usually need not take any special action
        ///      in this case).
        ///      Return TRUE if successful.
        /// </devdoc>
        [PreserveSig]
        bool FOnComponentActivate(IntPtr dwComponentID);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FSetTrackingComponent"]/*' />
        /// <devdoc>
        ///      Called to inform component manager that  component identified by 
        ///      dwComponentID (cookie returned from FRegisterComponent) wishes
        ///      to perform a tracking operation (such as mouse tracking).
        ///      The component calls this method with fTrack == TRUE to begin the
        ///      tracking operation and with fTrack == FALSE to end the operation.
        ///      During the tracking operation the component manager routes messages
        ///      to the tracking component (via IMsoComponent::FPreTranslateMessage)
        ///      rather than to the active component.  When the tracking operation ends,
        ///      the component manager should resume routing messages to the active
        ///      component.  
        ///      Note: component manager should perform no idle time processing during a
        ///              tracking operation other than give the tracking component idle
        ///              time via IMsoComponent::FDoIdle.
        ///      Note: there can only be one tracking component at a time.
        ///      Return TRUE if successful, FALSE otherwise.
        /// </devdoc>
        [PreserveSig]
        bool FSetTrackingComponent(IntPtr dwComponentID, [In, MarshalAs(UnmanagedType.Bool)] bool fTrack);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.OnComponentEnterState"]/*' />
        /// <devdoc>
        ///      Notify component manager that component identified by dwComponentID
        ///      (cookie returned from FRegisterComponent) is entering the state
        ///      identified by uStateID (msocstateXXX value).  (For convenience when
        ///      dealing with sub CompMgrs, the host can call this method passing 0 for
        ///      dwComponentID.)  
        ///      Component manager should notify all other interested components within
        ///      the state context indicated by uContext (a msoccontextXXX value),
        ///      excluding those within the state context of a CompMgr in rgpicmExclude,
        ///      via IMsoComponent::OnEnterState (see "Comments on State Contexts", 
        ///      above).
        ///      Component Manager should also take appropriate action depending on the 
        ///      value of uStateID (see msocstate comments, above).
        ///      dwReserved is reserved for future use and should be zero.
        ///      
        ///      rgpicmExclude (can be NULL) is an array of cpicmExclude CompMgrs (can
        ///      include root CompMgr and/or sub CompMgrs); components within the state
        ///      context of a CompMgr appearing in this array should NOT be notified of 
        ///      the state change (note: if uContext    is msoccontextMine, the only 
        ///      CompMgrs in rgpicmExclude that are checked for exclusion are those that 
        ///      are sub CompMgrs of this Component Manager, since all other CompMgrs 
        ///      are outside of this Component Manager's state context anyway.)
        ///      
        ///      Note: Calls to this method are symmetric with calls to 
        ///      FOnComponentExitState. 
        ///      That is, if n OnComponentEnterState calls are made, the component is
        ///      considered to be in the state until n FOnComponentExitState calls are
        ///      made.  Before revoking its registration a component must make a 
        ///      sufficient number of FOnComponentExitState calls to offset any
        ///      outstanding OnComponentEnterState calls it has made.
        ///      
        ///      Note: inplace objects should not call this method with
        ///      uStateID == msocstateModal when entering modal state. Such objects
        ///      should call IOleInPlaceFrame::EnableModeless instead.
        /// </devdoc>
        [PreserveSig]
        void OnComponentEnterState(IntPtr dwComponentID,int uStateID,int uContext,int cpicmExclude,/* IMsoComponentManger** */ int rgpicmExclude,int dwReserved);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FOnComponentExitState"]/*' />
        /// <devdoc>
        ///      Notify component manager that component identified by dwComponentID
        ///      (cookie returned from FRegisterComponent) is exiting the state
        ///      identified by uStateID (a msocstateXXX value).  (For convenience when
        ///      dealing with sub CompMgrs, the host can call this method passing 0 for
        ///      dwComponentID.)
        ///      uContext, cpicmExclude, and rgpicmExclude are as they are in 
        ///      OnComponentEnterState.
        ///      Component manager      should notify all appropriate interested components
        ///      (taking into account uContext, cpicmExclude, rgpicmExclude) via
        ///      IMsoComponent::OnEnterState (see "Comments on State Contexts", above). 
        ///      Component Manager should also take appropriate action depending on
        ///      the value of uStateID (see msocstate comments, above).
        ///      Return TRUE if, at the end of this call, the state is still in effect
        ///      at the root of this component manager's state context
        ///      (because the host or some other component is still in the state),
        ///      otherwise return FALSE (ie. return what FInState would return).
        ///      Caller can normally ignore the return value.
        ///      
        ///      Note: n calls to this method are symmetric with n calls to 
        ///      OnComponentEnterState (see OnComponentEnterState comments, above).
        /// </devdoc>
        [PreserveSig]
        bool FOnComponentExitState(
            IntPtr dwComponentID,
            int uStateID,     
            int uContext,     
            int cpicmExclude, 
            /* IMsoComponentManager** */ int rgpicmExclude);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FInState"]/*' />
        /// <devdoc>
        ///      Return TRUE if the state identified by uStateID (a msocstateXXX value)
        ///      is in effect at the root of this component manager's state context, 
        ///      FALSE otherwise (see "Comments on State Contexts", above).
        ///      pvoid is reserved for future use and should be NULL.
        /// </devdoc>
        [PreserveSig]
        bool FInState(int uStateID,/* PVOID */ IntPtr pvoid);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FContinueIdle"]/*' />
        /// <devdoc>
        ///      Called periodically by a component during IMsoComponent::FDoIdle.
        ///      Return TRUE if component can continue its idle time processing, 
        ///      FALSE if not (in which case component returns from FDoIdle.) 
        /// </devdoc>
        [PreserveSig]
        bool FContinueIdle();
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop"]/*' />
        /// <devdoc>
        ///      Component identified by dwComponentID (cookie returned from 
        ///      FRegisterComponent) wishes to push a message loop for reason uReason.
        ///      uReason is one the values from the msoloop enumeration (above).
        ///      pvLoopData is data private to the component.
        ///      The component manager should push its message loop, 
        ///      calling IMsoComponent::FContinueMessageLoop(uReason, pvLoopData)
        ///      during each loop iteration (see IMsoComponent::FContinueMessageLoop
        ///      comments).  When IMsoComponent::FContinueMessageLoop returns FALSE, the
        ///      component manager terminates the loop.
        ///      Returns TRUE if component manager terminates loop because component
        ///      told it to (by returning FALSE from IMsoComponent::FContinueMessageLoop),
        ///      FALSE if it had to terminate the loop for some other reason.  In the 
        ///      latter case, component should perform any necessary action (such as 
        ///      cleanup).
        /// </devdoc>
        [PreserveSig]
        bool FPushMessageLoop(IntPtr dwComponentID,int uReason,/* PVOID */ int pvLoopData);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FCreateSubComponentManager"]/*' />
        /// <devdoc>
        ///      Cause the component manager to create a "sub" component manager, which
        ///      will be one of its children in the hierarchical tree of component
        ///      managers used to maintiain state contexts (see "Comments on State
        ///      Contexts", above).
        ///      piunkOuter is the controlling unknown (can be NULL), riid is the
        ///      desired IID, and *ppvObj returns       the created sub component manager.
        ///      piunkServProv (can be NULL) is a ptr to an object supporting
        ///      IServiceProvider interface to which the created sub component manager
        ///      will delegate its IMsoComponentManager::QueryService calls. 
        ///      (see objext.h or docobj.h for definition of IServiceProvider).
        ///      Returns TRUE if successful.
        /// </devdoc>
        [PreserveSig]
        bool FCreateSubComponentManager(
            [MarshalAs(UnmanagedType.Interface)]
            object punkOuter,
            [MarshalAs(UnmanagedType.Interface)]
            object punkServProv,
            ref Guid riid,
            out IntPtr ppvObj);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FGetParentComponentManager"]/*' />
        /// <devdoc>
        ///      Return in *ppicm an AddRef'ed ptr to this component manager's parent
        ///      in the hierarchical tree of component managers used to maintain state
        ///      contexts (see "Comments on State       Contexts", above).
        ///      Returns TRUE if the parent is returned, FALSE if no parent exists or
        ///      some error occurred.
        /// </devdoc>
        [PreserveSig]
        bool FGetParentComponentManager(
            out IMsoComponentManager ppicm);
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponentManager.FGetActiveComponent"]/*' />
        /// <devdoc>
        ///      Return in *ppic an AddRef'ed ptr to the current active or tracking
        ///      component (as indicated by dwgac (a msogacXXX value)), and
        ///      its registration information in *pcrinfo.  ppic and/or pcrinfo can be
        ///      NULL if caller is not interested these values.  If pcrinfo is not NULL,
        ///      caller should set pcrinfo->cbSize before calling this method.
        ///      Returns TRUE if the component indicated by dwgac exists, FALSE if no 
        ///      such component exists or some error occurred.
        ///      dwReserved is reserved for future use and should be zero.
        /// </devdoc>
        [PreserveSig]
        bool FGetActiveComponent(
        int dwgac,
            [Out, MarshalAs(UnmanagedType.LPArray)]
            IMsoComponent[] ppic,
            NativeMethods.MSOCRINFOSTRUCT pcrinfo,
            int dwReserved);
        }
        
        [ComImport(), 
        Guid("000C0600-0000-0000-C000-000000000046"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
        ]
        public interface IMsoComponent {
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.FDebugMessage"]/*' />
            /// <devdoc>
            ///      Standard FDebugMessage method.
            ///      Since IMsoComponentManager is a reference counted interface, 
            ///      MsoDWGetChkMemCounter should be used when processing the 
            ///      msodmWriteBe message.
            /// </devdoc>
            [PreserveSig]
            bool FDebugMessage(
                IntPtr hInst, 
                int msg, 
                IntPtr wParam, 
                IntPtr lParam);
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage"]/*' />
            /// <devdoc>
            ///      Give component a chance to process the message pMsg before it is
            ///      translated and dispatched. Component can do TranslateAccelerator
            ///      do IsDialogMessage, modify pMsg, or take some other action.
            ///      Return TRUE if the message is consumed, FALSE otherwise.
            /// </devdoc>
            [PreserveSig]
            bool FPreTranslateMessage(ref NativeMethods.MSG msg);            
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.OnEnterState"]/*' />
            /// <devdoc>  
            ///      Notify component when app enters or exits (as indicated by fEnter)
            ///      the state identified by uStateID (a value from olecstate enumeration).
            ///      Component should take action depending on value of uStateID
            ///       (see olecstate comments, above).
            ///
            ///      Note: If n calls are made with TRUE fEnter, component should consider 
            ///      the state to be in effect until n calls are made with FALSE fEnter.
            ///     
            ///     Note: Components should be aware that it is possible for this method to
            ///     be called with FALSE fEnter more    times than it was called with TRUE 
            ///     fEnter (so, for example, if component is maintaining a state counter
            ///     (incremented when this method is called with TRUE fEnter, decremented
            ///     when called with FALSE fEnter), the counter should not be decremented
            ///     for FALSE fEnter if it is already at zero.)  
            /// </devdoc>
            [PreserveSig]
            void OnEnterState(
                int uStateID,
                bool fEnter);
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.OnAppActivate"]/*' />
            /// <devdoc>  
            ///      Notify component when the host application gains or loses activation.
            ///     If fActive is TRUE, the host app is being activated and dwOtherThreadID
            ///      is the ID of the thread owning the window being deactivated.
            ///      If fActive is FALSE, the host app is being deactivated and 
            ///      dwOtherThreadID is the ID of the thread owning the window being 
            ///      activated.
            ///      Note: this method is not called when both the window being activated
            ///      and the one being deactivated belong to the host app.
            /// </devdoc>
            [PreserveSig]
            void OnAppActivate(
                bool fActive,
                int dwOtherThreadID);                
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.OnLoseActivation"]/*' />
            /// <devdoc>      
            ///      Notify the active component that it has lost its active status because
            ///      the host or another component has become active.
            /// </devdoc>
            [PreserveSig]
            void OnLoseActivation();
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.OnActivationChange"]/*' />
            /// <devdoc> 
            ///      Notify component when a new object is being activated.
            ///      If pic is non-NULL, then it is the component that is being activated.
            ///      In this case, fSameComponent is TRUE if pic is the same component as
            ///      the callee of this method, and pcrinfo is the reg info of pic.
            ///      If pic is NULL and fHostIsActivating is TRUE, then the host is the
            ///      object being activated, and pchostinfo is its host info.
            ///      If pic is NULL and fHostIsActivating is FALSE, then there is no current
            ///      active object.
            ///
            ///      If pic is being activated and pcrinfo->grf has the 
            ///      olecrfExclusiveBorderSpace bit set, component should hide its border
            ///      space tools (toolbars, status bars, etc.);
            ///      component should also do this if host is activating and 
            ///      pchostinfo->grfchostf has the olechostfExclusiveBorderSpace bit set.
            ///      In either of these cases, component should unhide its border space
            ///      tools the next time it is activated.
            ///
            ///      if pic is being activated and pcrinfo->grf has the
            ///      olecrfExclusiveActivation bit is set, then pic is being activated in
            ///      "ExclusiveActive" mode.  
            ///      Component should retrieve the top frame window that is hosting pic
            ///      (via pic->HwndGetWindow(olecWindowFrameToplevel, 0)).  
            ///      If this window is different from component's own top frame window, 
            ///         component should disable its windows and do other things it would do
            ///         when receiving OnEnterState(olecstateModal, TRUE) notification. 
            ///      Otherwise, if component is top-level, 
            ///         it should refuse to have its window activated by appropriately
            ///         processing WM_MOUSEACTIVATE (but see WM_MOUSEACTIVATE NOTE, above).
            ///      Component should remain in one of these states until the 
            ///      ExclusiveActive mode ends, indicated by a future call to 
            ///      OnActivationChange with ExclusiveActivation bit not set or with NULL
            ///      pcrinfo.
            /// </devdoc>
            [PreserveSig]
            void OnActivationChange(
                IMsoComponent component,
                bool fSameComponent,
                int pcrinfo,
                bool fHostIsActivating,
                int pchostinfo,
                int dwReserved);
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.FDoIdle"]/*' />
            /// <devdoc> 
            ///      Give component a chance to do idle time tasks.  grfidlef is a group of
            ///      bit flags taken from the enumeration of oleidlef values (above),
            ///      indicating the type of idle tasks to perform.  
            ///      Component may periodically call IOleComponentManager::FContinueIdle; 
            ///      if this method returns FALSE, component should terminate its idle 
            ///      time processing and return.  
            ///      Return TRUE if more time is needed to perform the idle time tasks, 
            ///      FALSE otherwise.
            ///      Note: If a component reaches a point where it has no idle tasks
            ///      and does not need FDoIdle calls, it should remove its idle task
            ///      registration via IOleComponentManager::FUpdateComponentRegistration.
            ///      Note: If this method is called on while component is performing a 
            ///      tracking operation, component should only perform idle time tasks that
            ///      it deems are appropriate to perform during tracking.
            /// </devdoc>
            [PreserveSig]
            bool FDoIdle(
                int grfidlef);            
 
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.FContinueMessageLoop"]/*' />
            /// <devdoc>         
            ///      Called during each iteration of a message loop that the component
            ///      pushed. uReason and pvLoopData are the reason and the component private 
            ///      data that were passed to IOleComponentManager::FPushMessageLoop.
            ///      This method is called after peeking the next message in the queue
            ///      (via PeekMessage) but before the message is removed from the queue.
            ///      The peeked message is passed in the pMsgPeeked param (NULL if no
            ///      message is in the queue).  This method may be additionally called when
            ///      the next message has already been removed from the queue, in which case
            ///      pMsgPeeked is passed as NULL.
            ///      Return TRUE if the message loop should continue, FALSE otherwise.
            ///      If FALSE is returned, the component manager terminates the loop without
            ///      removing pMsgPeeked from the queue. 
            /// </devdoc>
            [PreserveSig]
            bool FContinueMessageLoop(
                int uReason,
                int pvLoopData,
                [MarshalAs(UnmanagedType.LPArray)] NativeMethods.MSG[] pMsgPeeked);            
 
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.FQueryTerminate"]/*' />
            /// <devdoc> 
            ///      Called when component manager wishes to know if the component is in a
            ///      state in which it can terminate.  If fPromptUser is FALSE, component
            ///      should simply return TRUE if it can terminate, FALSE otherwise.
            ///      If fPromptUser is TRUE, component should return TRUE if it can
            ///      terminate without prompting the user; otherwise it should prompt the
            ///      user, either 1.) asking user if it can terminate and returning TRUE
            ///      or FALSE appropriately, or 2.) giving an indication as to why it
            ///      cannot terminate and returning FALSE. 
            /// </devdoc>
            [PreserveSig]
            bool FQueryTerminate(
                bool fPromptUser);
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.Terminate"]/*' />
            /// <devdoc>     
            ///      Called when component manager wishes to terminate the component's
            ///      registration.  Component should revoke its registration with component
            ///      manager, release references to component manager and perform any
            ///      necessary cleanup. 
            /// </devdoc>
            [PreserveSig]
            void Terminate();
 
            /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods.IMsoComponent.HwndGetWindow"]/*' />
            /// <devdoc> 
            ///      Called to retrieve a window associated with the component, as specified
            ///      by dwWhich, a olecWindowXXX value (see olecWindow, above).
            ///      dwReserved is reserved for future use and should be zero.
            ///      Component should return the desired window or NULL if no such window
            ///      exists. 
            /// </devdoc>
            
            [PreserveSig]
            IntPtr HwndGetWindow(
                int dwWhich,
                int dwReserved);
        }
 
        [ComVisible(true), Guid("8CC497C0-A1DF-11ce-8098-00AA0047BE5D"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual),
        SuppressUnmanagedCodeSecurity()]
        public interface ITextDocument {
            string GetName();
            object GetSelection();
            int GetStoryCount();
            object GetStoryRanges();
            int GetSaved();
            void SetSaved(int value);
            object GetDefaultTabStop();
            void SetDefaultTabStop(object value);
            void New();
            void Open(object pVar, int flags, int codePage);
            void Save(object pVar, int flags, int codePage);
            int Freeze();
            int Unfreeze();
            void BeginEditCollection();
            void EndEditCollection();
            int Undo(int count);
            int Redo(int count);
            [return: MarshalAs(UnmanagedType.Interface)] ITextRange Range(int cp1, int cp2);
            [return: MarshalAs(UnmanagedType.Interface)] ITextRange RangeFromPoint(int x, int y);
        };
 
        [ComVisible(true), Guid("8CC497C2-A1DF-11ce-8098-00AA0047BE5D"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual),
        SuppressUnmanagedCodeSecurity()]
        public interface ITextRange {
            string GetText();
            void SetText(string text);
            object GetChar();
            void SetChar(object ch);
            [return: MarshalAs(UnmanagedType.Interface)] ITextRange GetDuplicate();
            [return: MarshalAs(UnmanagedType.Interface)] ITextRange GetFormattedText();
            void SetFormattedText([In, MarshalAs(UnmanagedType.Interface)] ITextRange range);
            int GetStart();
            void SetStart(int cpFirst);
            int GetEnd();
            void SetEnd(int cpLim);
            object GetFont();
            void SetFont(object font);
            object GetPara();
            void SetPara(object para);
            int GetStoryLength();
            int GetStoryType();
            void Collapse(int start);
            int Expand(int unit);
            int GetIndex(int unit);
            void SetIndex(int unit, int index, int extend);
            void SetRange(int cpActive, int cpOther);
            int InRange([In, MarshalAs(UnmanagedType.Interface)] ITextRange range);
            int InStory([In, MarshalAs(UnmanagedType.Interface)] ITextRange range);
            int IsEqual([In, MarshalAs(UnmanagedType.Interface)] ITextRange range);
            void Select();
            int StartOf(int unit, int extend);
            int EndOf(int unit, int extend);
            int Move(int unit, int count);
            int MoveStart(int unit, int count);
            int MoveEnd(int unit, int count);
            int MoveWhile(object cset, int count);
            int MoveStartWhile(object cset, int count);
            int MoveEndWhile(object cset, int count);
            int MoveUntil(object cset, int count);
            int MoveStartUntil(object cset, int count);
            int MoveEndUntil(object cset, int count);
            int FindText(string text, int cch, int flags);
            int FindTextStart(string text, int cch, int flags);
            int FindTextEnd(string text, int cch, int flags);
            int Delete(int unit, int count);
            void Cut([Out] out object pVar);
            void Copy([Out] out object pVar);
            void Paste(object pVar, int format);
            int CanPaste(object pVar, int format);
            int CanEdit();
            void ChangeCase(int type);
            void GetPoint(int type, [Out] out int x, [Out] out int y);
            void SetPoint(int x, int y, int type, int extend);
            void ScrollIntoView(int value);
            object GetEmbeddedObject();
        };
 
        [ComImport(), Guid("00020D03-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IRichEditOleCallback {
            [PreserveSig]
            int GetNewStorage(out IStorage ret);
            
            [PreserveSig]
            int GetInPlaceContext(IntPtr lplpFrame, IntPtr lplpDoc, IntPtr lpFrameInfo);
            
            [PreserveSig]
            int ShowContainerUI(int fShow);
            
            [PreserveSig]
            int QueryInsertObject(ref Guid lpclsid, IntPtr lpstg, int cp);
            
            [PreserveSig]
            int DeleteObject(IntPtr lpoleobj);
            
            [PreserveSig]
            int QueryAcceptData(IComDataObject lpdataobj, /* CLIPFORMAT* */ IntPtr lpcfFormat, int reco, int fReally, IntPtr hMetaPict);
            
            [PreserveSig]
            int ContextSensitiveHelp(int fEnterMode);
            
            [PreserveSig]
            int GetClipboardData(NativeMethods.CHARRANGE lpchrg, int reco, IntPtr lplpdataobj);
 
            [PreserveSig]
            int GetDragDropEffect(bool fDrag, int grfKeyState, ref int pdwEffect);
            
            [PreserveSig]
            int GetContextMenu(short seltype, IntPtr lpoleobj, NativeMethods.CHARRANGE lpchrg, out IntPtr hmenu);
        }
        
        [ComImport(), Guid("00000115-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleInPlaceUIWindow {
             IntPtr GetWindow();
            
             [PreserveSig]
             int ContextSensitiveHelp(
                     
                     int fEnterMode);
 
            
             [PreserveSig]
             int GetBorder(
                    [Out] 
                      NativeMethods.COMRECT lprectBorder);
 
            
             [PreserveSig]
             int RequestBorderSpace(
                    [In] 
                      NativeMethods.COMRECT pborderwidths);
 
            
             [PreserveSig]
             int SetBorderSpace(
                    [In] 
                      NativeMethods.COMRECT pborderwidths);
 
            
             void SetActiveObject(
                    [In, MarshalAs(UnmanagedType.Interface)] 
                      UnsafeNativeMethods.IOleInPlaceActiveObject pActiveObject,
                    [In, MarshalAs(UnmanagedType.LPWStr)] 
                      string pszObjName);
 
 
        }
        [SuppressUnmanagedCodeSecurity, ComImport(),
        Guid("00000117-0000-0000-C000-000000000046"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleInPlaceActiveObject {
 
             [PreserveSig]
             int GetWindow( out IntPtr hwnd );
 
            
             void ContextSensitiveHelp(
                    
                     int fEnterMode);
 
            
             [PreserveSig]
             int TranslateAccelerator(
                    [In]
                      ref NativeMethods.MSG lpmsg);
 
            
             void OnFrameWindowActivate(
                    
                     bool fActivate);
 
            
             void OnDocWindowActivate(
                    
                     int fActivate);
 
            
             void ResizeBorder(
                    [In]
                      NativeMethods.COMRECT prcBorder,
                    [In]
                      UnsafeNativeMethods.IOleInPlaceUIWindow pUIWindow,
                    
                     bool fFrameWindow);
 
            
             void EnableModeless(
                    
                     int fEnable);
 
 
        }
        [ComImport(), Guid("00000114-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleWindow {
 
             [PreserveSig]
             int GetWindow( [Out]out IntPtr hwnd );
 
            
             void ContextSensitiveHelp(
                     
                     int fEnterMode);
        }
        [SuppressUnmanagedCodeSecurity, ComImport(),
        Guid("00000113-0000-0000-C000-000000000046"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleInPlaceObject {
 
             [PreserveSig]
             int GetWindow( [Out]out IntPtr hwnd );
 
            
             void ContextSensitiveHelp(
                     
                     int fEnterMode);
 
            
             void InPlaceDeactivate();
 
            
             [PreserveSig]
             int UIDeactivate();
 
            
             void SetObjectRects(
                    [In] 
                      NativeMethods.COMRECT lprcPosRect,
                    [In] 
                      NativeMethods.COMRECT lprcClipRect);
 
            
             void ReactivateAndUndo();
 
 
        }
        [SuppressUnmanagedCodeSecurity, ComImport(),
        Guid("00000112-0000-0000-C000-000000000046"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleObject {
 
             [PreserveSig]
             int SetClientSite(
                    [In, MarshalAs(UnmanagedType.Interface)]
                      UnsafeNativeMethods.IOleClientSite pClientSite);
 
             
             UnsafeNativeMethods.IOleClientSite GetClientSite();
 
             [PreserveSig]
             int SetHostNames(
                    [In, MarshalAs(UnmanagedType.LPWStr)]
                      string szContainerApp,
                    [In, MarshalAs(UnmanagedType.LPWStr)]
                      string szContainerObj);
 
             [PreserveSig]
             int Close(
                    
                     int dwSaveOption);
 
             [PreserveSig]
             int SetMoniker(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwWhichMoniker,
                    [In, MarshalAs(UnmanagedType.Interface)]
                     object pmk);
 
              [PreserveSig]
              int GetMoniker(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwAssign,
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwWhichMoniker,
                    [Out, MarshalAs(UnmanagedType.Interface)]
                     out object moniker);
 
             [PreserveSig]
             int InitFromData(
                    [In, MarshalAs(UnmanagedType.Interface)]
                     IComDataObject pDataObject,
                    
                     int fCreation,
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwReserved);
 
             [PreserveSig]
             int GetClipboardData(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwReserved,
                     out IComDataObject data);
 
             [PreserveSig]
             int DoVerb(
                    
                     int iVerb,
                    [In]
                     IntPtr lpmsg,
                    [In, MarshalAs(UnmanagedType.Interface)]
                      UnsafeNativeMethods.IOleClientSite pActiveSite,
                    
                     int lindex,
                    
                     IntPtr hwndParent,
                    [In]
                     NativeMethods.COMRECT lprcPosRect);
 
             [PreserveSig]
             int EnumVerbs(out UnsafeNativeMethods.IEnumOLEVERB e);
 
             [PreserveSig]
             int OleUpdate();
 
             [PreserveSig]
             int IsUpToDate();
 
             [PreserveSig]
             int GetUserClassID(
                    [In, Out]
                      ref Guid pClsid);
 
             [PreserveSig]
             int GetUserType(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwFormOfType,
                    [Out, MarshalAs(UnmanagedType.LPWStr)]
                     out string userType);
 
             [PreserveSig]
             int SetExtent(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwDrawAspect,
                    [In]
                     NativeMethods.tagSIZEL pSizel);
 
             [PreserveSig]
             int GetExtent(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwDrawAspect,
                    [Out]
                     NativeMethods.tagSIZEL pSizel);
 
             [PreserveSig]
             int Advise(
                     IAdviseSink pAdvSink,
                     out int cookie);
 
             [PreserveSig]
             int Unadvise(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwConnection);
 
              [PreserveSig]
              int EnumAdvise(out IEnumSTATDATA e);
 
             [PreserveSig]
             int GetMiscStatus(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwAspect,
                     out int misc);
 
             [PreserveSig]
             int SetColorScheme(
                    [In]
                      NativeMethods.tagLOGPALETTE pLogpal);
        }
        
        [ComImport(), Guid("1C2056CC-5EF4-101B-8BC8-00AA003E3B29"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleInPlaceObjectWindowless {
 
             [PreserveSig]
             int SetClientSite(
                    [In, MarshalAs(UnmanagedType.Interface)]
                      UnsafeNativeMethods.IOleClientSite pClientSite);
 
             [PreserveSig]
             int GetClientSite(out UnsafeNativeMethods.IOleClientSite site);
 
             [PreserveSig]
             int SetHostNames(
                    [In, MarshalAs(UnmanagedType.LPWStr)]
                      string szContainerApp,
                    [In, MarshalAs(UnmanagedType.LPWStr)]
                      string szContainerObj);
 
             [PreserveSig]
             int Close(
                    
                     int dwSaveOption);
 
             [PreserveSig]
             int SetMoniker(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwWhichMoniker,
                    [In, MarshalAs(UnmanagedType.Interface)]
                     object pmk);
 
              [PreserveSig]
              int GetMoniker(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwAssign,
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwWhichMoniker,
                    [Out, MarshalAs(UnmanagedType.Interface)]
                     out object moniker);
 
             [PreserveSig]
             int InitFromData(
                    [In, MarshalAs(UnmanagedType.Interface)]
                     IComDataObject pDataObject,
                    
                     int fCreation,
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwReserved);
 
             [PreserveSig]
             int GetClipboardData(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwReserved,
                     out IComDataObject data);
 
             [PreserveSig]
             int DoVerb(
                    
                     int iVerb,
                    [In]
                     IntPtr lpmsg,
                    [In, MarshalAs(UnmanagedType.Interface)]
                      UnsafeNativeMethods.IOleClientSite pActiveSite,
                    
                     int lindex,
                    
                     IntPtr hwndParent,
                    [In]
                     NativeMethods.COMRECT lprcPosRect);
 
             [PreserveSig]
             int EnumVerbs(out UnsafeNativeMethods.IEnumOLEVERB e);
 
             [PreserveSig]
             int OleUpdate();
 
             [PreserveSig]
             int IsUpToDate();
 
             [PreserveSig]
             int GetUserClassID(
                    [In, Out]
                      ref Guid pClsid);
 
             [PreserveSig]
             int GetUserType(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwFormOfType,
                    [Out, MarshalAs(UnmanagedType.LPWStr)]
                     out string userType);
 
             [PreserveSig]
             int SetExtent(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwDrawAspect,
                    [In]
                     NativeMethods.tagSIZEL pSizel);
 
             [PreserveSig]
             int GetExtent(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwDrawAspect,
                    [Out]
                     NativeMethods.tagSIZEL pSizel);
 
             [PreserveSig]
             int Advise(
                    [In, MarshalAs(UnmanagedType.Interface)]
                     IAdviseSink pAdvSink,
                     out int cookie);
 
             [PreserveSig]
             int Unadvise(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwConnection);
 
              [PreserveSig]
                  int EnumAdvise(out IEnumSTATDATA e);
 
             [PreserveSig]
             int GetMiscStatus(
                    [In, MarshalAs(UnmanagedType.U4)]
                     int dwAspect,
                     out int misc);
 
             [PreserveSig]
             int SetColorScheme(
                    [In]
                      NativeMethods.tagLOGPALETTE pLogpal);
            
             [PreserveSig]
             int OnWindowMessage( 
                [In, MarshalAs(UnmanagedType.U4)]  int msg,
                [In, MarshalAs(UnmanagedType.U4)]  int wParam,
                [In, MarshalAs(UnmanagedType.U4)]  int lParam,
                [Out, MarshalAs(UnmanagedType.U4)] int plResult);
 
             [PreserveSig]
             int GetDropTarget( 
                [Out, MarshalAs(UnmanagedType.Interface)] object ppDropTarget);
 
        };
 
        
        [SuppressUnmanagedCodeSecurity, ComImport(),
        Guid("B196B288-BAB4-101A-B69C-00AA00341D07"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleControl {
             [PreserveSig]
             int GetControlInfo(
                    [Out]
                      NativeMethods.tagCONTROLINFO pCI);
 
             [PreserveSig]
             int OnMnemonic(
                    [In]
                      ref NativeMethods.MSG pMsg);
 
             [PreserveSig]
             int OnAmbientPropertyChange(
                    
                     int dispID);
 
             [PreserveSig]
             int FreezeEvents(
                    
                     int bFreeze);
 
        }
        [ComImport(), Guid("6D5140C1-7436-11CE-8034-00AA006009FA"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IOleServiceProvider {
             [PreserveSig]
             int QueryService(
                  [In]
                      ref Guid guidService,
                  [In]
                  ref Guid riid,
                  out IntPtr ppvObject);
        }
        [ComImport(), Guid("0000010d-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IViewObject {
            [PreserveSig]
            int Draw(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwDrawAspect,
 
                int lindex,
 
                IntPtr pvAspect,
                [In]
                NativeMethods.tagDVTARGETDEVICE ptd,
 
                IntPtr hdcTargetDev,
 
                IntPtr hdcDraw,
                [In]
                NativeMethods.COMRECT lprcBounds,
                [In]
                NativeMethods.COMRECT lprcWBounds,
 
                IntPtr pfnContinue,
                [In]
                int dwContinue);
 
            
            [PreserveSig]
            int GetColorSet(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwDrawAspect,
 
                int lindex,
 
                IntPtr pvAspect,
                [In]
                NativeMethods.tagDVTARGETDEVICE ptd,
 
                IntPtr hicTargetDev,
                [Out]
                NativeMethods.tagLOGPALETTE ppColorSet);
 
            [PreserveSig]
            int Freeze(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwDrawAspect,
 
                int lindex,
 
                IntPtr pvAspect,
                [Out]
                IntPtr pdwFreeze);
 
            [PreserveSig]
            int Unfreeze(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwFreeze);
 
            
            void SetAdvise(
                [In, MarshalAs(UnmanagedType.U4)]
                int aspects,
                [In, MarshalAs(UnmanagedType.U4)]
                int advf,
                [In, MarshalAs(UnmanagedType.Interface)]
                IAdviseSink pAdvSink);
 
            
            void GetAdvise(
                // These can be NULL if caller doesn't want them
                [In, Out, MarshalAs(UnmanagedType.LPArray)]
                int[] paspects,
                // These can be NULL if caller doesn't want them
                [In, Out, MarshalAs(UnmanagedType.LPArray)]
                int[] advf,
                // These can be NULL if caller doesn't want them
                [In, Out, MarshalAs(UnmanagedType.LPArray)]
                IAdviseSink[] pAdvSink);
        }
        [ComImport(), Guid("00000127-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IViewObject2 /* : IViewObject */ {
            void Draw(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwDrawAspect,
 
                int lindex,
 
                IntPtr pvAspect,
                [In]
                NativeMethods.tagDVTARGETDEVICE ptd,
 
                IntPtr hdcTargetDev,
 
                IntPtr hdcDraw,
                [In]
                NativeMethods.COMRECT lprcBounds,
                [In]
                NativeMethods.COMRECT lprcWBounds,
 
                IntPtr pfnContinue,
                [In]
                int dwContinue);
 
            
            [PreserveSig]
            int GetColorSet(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwDrawAspect,
 
                int lindex,
 
                IntPtr pvAspect,
                [In]
                NativeMethods.tagDVTARGETDEVICE ptd,
 
                IntPtr hicTargetDev,
                [Out]
                NativeMethods.tagLOGPALETTE ppColorSet);
 
            
            [PreserveSig]
            int Freeze(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwDrawAspect,
 
                int lindex,
 
                IntPtr pvAspect,
                [Out]
                IntPtr pdwFreeze);
 
            
            [PreserveSig]
            int Unfreeze(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwFreeze);
 
            
            void SetAdvise(
                [In, MarshalAs(UnmanagedType.U4)]
                int aspects,
                [In, MarshalAs(UnmanagedType.U4)]
                int advf,
                [In, MarshalAs(UnmanagedType.Interface)]
                IAdviseSink pAdvSink);
 
            
            void GetAdvise(
                // These can be NULL if caller doesn't want them
                [In, Out, MarshalAs(UnmanagedType.LPArray)]
                int[] paspects,
                // These can be NULL if caller doesn't want them
                [In, Out, MarshalAs(UnmanagedType.LPArray)]
                int[] advf,
                // These can be NULL if caller doesn't want them
                [In, Out, MarshalAs(UnmanagedType.LPArray)]
                IAdviseSink[] pAdvSink);
 
            
            void GetExtent(
                [In, MarshalAs(UnmanagedType.U4)]
                int dwDrawAspect,
 
                int lindex,
                [In]
                NativeMethods.tagDVTARGETDEVICE ptd,
                [Out]
                NativeMethods.tagSIZEL lpsizel);
        }
 
        [ComImport(), Guid("0000010C-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IPersist {
 
            [ System.Security.SuppressUnmanagedCodeSecurityAttribute()]
            void GetClassID(
                           [Out] 
                           out Guid pClassID);
        }
 
        [ComImport(), Guid("37D84F60-42CB-11CE-8135-00AA004BB851"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IPersistPropertyBag {
            void GetClassID(
                [Out]
                out Guid pClassID);
 
            
            void InitNew();
 
            
            void Load(
                [In, MarshalAs(UnmanagedType.Interface)]
                IPropertyBag pPropBag,
                [In, MarshalAs(UnmanagedType.Interface)]
                IErrorLog pErrorLog);
 
            
            void Save(
                [In, MarshalAs(UnmanagedType.Interface)]
                IPropertyBag pPropBag,
                [In, MarshalAs(UnmanagedType.Bool)]
                bool fClearDirty,
                [In, MarshalAs(UnmanagedType.Bool)]
                bool fSaveAllProperties);
        }
        [
            ComImport(), 
        Guid("CF51ED10-62FE-11CF-BF86-00A0C9034836"),
        InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
        ]
        public interface IQuickActivate {
            void QuickActivate(
                              [In] 
                              UnsafeNativeMethods.tagQACONTAINER pQaContainer,
                              [Out] 
                              UnsafeNativeMethods.tagQACONTROL pQaControl);
 
            
            void SetContentExtent(
                                 [In] 
                                 NativeMethods.tagSIZEL pSizel);
 
            
            void GetContentExtent(
                                 [Out] 
                                 NativeMethods.tagSIZEL pSizel);
 
        }
 
        [ComImport(), Guid("000C060B-0000-0000-C000-000000000046"),
            SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
        public class SMsoComponentManager
        {
        }
 
        [ComImport(), Guid("55272A00-42CB-11CE-8135-00AA004BB851"), 
        InterfaceType(ComInterfaceType.InterfaceIsIUnknown)
        ]
        public interface IPropertyBag {
            [PreserveSig]
            int Read(
                [In, MarshalAs(UnmanagedType.LPWStr)]
                string pszPropName,
                [In, Out]
                ref object pVar,
                [In]
                IErrorLog pErrorLog);
 
            [PreserveSig]
            int Write(
                [In, MarshalAs(UnmanagedType.LPWStr)]
                string pszPropName,
                [In]
                ref object pVar);
        }
 
    [ComImport(), Guid("3127CA40-446E-11CE-8135-00AA004BB851"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
            public interface IErrorLog {
                     void AddError(
                            [In, MarshalAs(UnmanagedType.LPWStr)] 
                             string pszPropName_p0,
                            [In, MarshalAs(UnmanagedType.Struct)] 
                              NativeMethods.tagEXCEPINFO pExcepInfo_p1);
 
            }
 
    [ComImport(), Guid("00000109-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IPersistStream {
 
         void GetClassID([Out] out Guid pClassId);
 
         [PreserveSig]
         int IsDirty();
 
        
         void Load(
                [In, MarshalAs(UnmanagedType.Interface)] 
                  UnsafeNativeMethods.IStream pstm);
 
        
         void Save(
                [In, MarshalAs(UnmanagedType.Interface)] 
                  UnsafeNativeMethods.IStream pstm,
                [In, MarshalAs(UnmanagedType.Bool)] 
                 bool fClearDirty);
 
        
         long GetSizeMax();
 
 
    }
 
    [SuppressUnmanagedCodeSecurity, ComImport(),
    Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"),
    InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IPersistStreamInit {
         void GetClassID(
                [Out] 
                  out Guid pClassID);
 
 
         [PreserveSig]
         int IsDirty();
 
        
         void Load(
                [In, MarshalAs(UnmanagedType.Interface)] 
                  UnsafeNativeMethods.IStream pstm);
 
            
             void Save(
                    [In, MarshalAs(UnmanagedType.Interface)] 
                      IStream pstm,
                    [In, MarshalAs(UnmanagedType.Bool)] 
                     bool fClearDirty);
 
        
         void GetSizeMax(
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 long pcbSize);
 
        
         void InitNew();
 
 
    }
 
    [SuppressUnmanagedCodeSecurity, ComImport(),
    Guid("B196B286-BAB4-101A-B69C-00AA00341D07"),
    InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IConnectionPoint {
 
        [PreserveSig]
        int GetConnectionInterface(out Guid iid);
 
 
        [PreserveSig]
        int GetConnectionPointContainer(
            [MarshalAs(UnmanagedType.Interface)]
            ref IConnectionPointContainer pContainer);
 
 
         [PreserveSig]
         int Advise(
                [In, MarshalAs(UnmanagedType.Interface)] 
                  object pUnkSink,
              ref int cookie);
 
 
        [PreserveSig]
        int Unadvise(
 
                 int cookie);
 
        [PreserveSig]
        int EnumConnections(out object pEnum);
 
    }
 
    [ComImport(), Guid("0000010A-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IPersistStorage {
         void GetClassID(
                [Out] 
                  out Guid pClassID);
 
         [PreserveSig]
         int IsDirty();
 
         void InitNew(IStorage pstg);
        
         [PreserveSig]
         int Load(IStorage pstg);
        
         void Save(IStorage pStgSave, bool fSameAsLoad);
        
         void SaveCompleted(IStorage pStgNew);
        
         void HandsOffStorage();
    }
 
    [ComImport(), Guid("00020404-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IEnumVariant {
         [PreserveSig]
         int Next(
                [In, MarshalAs(UnmanagedType.U4)] 
                 int celt,
                [In, Out] 
                 IntPtr rgvar,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 int[] pceltFetched);
        
         void Skip(
                [In, MarshalAs(UnmanagedType.U4)] 
                 int celt);
 
         void Reset();
        
         void Clone(
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   UnsafeNativeMethods.IEnumVariant[] ppenum);
    }
 
    [ComImport(), Guid("00000104-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IEnumOLEVERB {
 
 
         [PreserveSig]
         int Next(
                [MarshalAs(UnmanagedType.U4)] 
                int celt,
                [Out]
                NativeMethods.tagOLEVERB rgelt,
                [Out, MarshalAs(UnmanagedType.LPArray)]
                int[] pceltFetched);
 
         [PreserveSig]
         int Skip(
                [In, MarshalAs(UnmanagedType.U4)] 
                 int celt);
 
        
         void Reset();
 
        
         void Clone(
            out IEnumOLEVERB ppenum);
    }
 
    // INTERFACE: IEnumACString
 
    // This interface was implemented to return autocomplete strings
    // into the caller's buffer (to reduce the number of memory allocations
    // A sort index is also returned to control the order of items displayed
    // by autocomplete.  The sort index should be set to zero if unused
    // The NextItem method increments the current index by one (similar to Next
    // when one item is requested
 
    //public interface IEnumString 
    //Do not declare IEnumString here -- use IEnumString from interopservices.
    // even if it looks like it works, if you declaring the marshalling incorrectly, it will barf on appverifier.
 
 
    //-------------------------------------------------------------------------
    // IAutoComplete interface
    // [Member functions]
    // IAutoComplete::Init(hwndEdit, punkACL, pwszRegKeyPath, pwszQuickComplete)
    // This function initializes an AutoComplete object, telling it
    // what control to subclass, and what list of strings to process.
    // IAutoComplete::Enable(fEnable)
    // This function enables or disables the AutoComplete functionality.
    //-------------------------------------------------------------------------
    
    [SuppressUnmanagedCodeSecurity, ComImport(), Guid("00bb2762-6a77-11d0-a535-00c04fd7d062"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IAutoComplete
    {
        
        int Init(
                [In] HandleRef hwndEdit,          // hwnd of editbox or editbox deriviative.
                [In] System.Runtime.InteropServices.ComTypes.IEnumString punkACL,          // Pointer to object containing string to complete from. (IEnumString *)
                [In] string pwszRegKeyPath,       //
                [In] string pwszQuickComplete
                );
        void Enable([In] bool fEnable);            // Is it enabled?
    }
    
    
    [SuppressUnmanagedCodeSecurity, ComImport(), Guid("EAC04BC0-3791-11d2-BB95-0060977B464C"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    
    public interface IAutoComplete2 
    {
        int Init(
                [In] HandleRef hwndEdit,          // hwnd of editbox or editbox deriviative.
                [In] System.Runtime.InteropServices.ComTypes.IEnumString punkACL,          // Pointer to object containing string to complete from. (IEnumString *)
                [In] string pwszRegKeyPath,       //
                [In] string pwszQuickComplete
                );
        void  Enable([In] bool fEnable);            // Is it enabled?
        
        int  SetOptions([In] int dwFlag);
        void GetOptions([Out] IntPtr pdwFlag);
    }
 
    [SuppressUnmanagedCodeSecurity, ComImport(), Guid("0000000C-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStream {
 
         int Read(
 
                 IntPtr buf,
 
                 int len);
 
        
         int Write(
 
                 IntPtr buf,
 
                 int len);
 
        [return: MarshalAs(UnmanagedType.I8)]
         long Seek(
                [In, MarshalAs(UnmanagedType.I8)] 
                 long dlibMove,
 
                 int dwOrigin);
 
        
         void SetSize(
                [In, MarshalAs(UnmanagedType.I8)] 
                 long libNewSize);
 
        [return: MarshalAs(UnmanagedType.I8)]
         long CopyTo(
                [In, MarshalAs(UnmanagedType.Interface)] 
                  UnsafeNativeMethods.IStream pstm,
                [In, MarshalAs(UnmanagedType.I8)] 
                 long cb,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 long[] pcbRead);
 
        
         void Commit(
 
                 int grfCommitFlags);
 
        
         void Revert();
 
        
         void LockRegion(
                [In, MarshalAs(UnmanagedType.I8)] 
                 long libOffset,
                [In, MarshalAs(UnmanagedType.I8)] 
                 long cb,
 
                 int dwLockType);
 
        
         void UnlockRegion(
                [In, MarshalAs(UnmanagedType.I8)] 
                 long libOffset,
                [In, MarshalAs(UnmanagedType.I8)] 
                 long cb,
 
                 int dwLockType);
 
        
         void Stat(
                 [Out] 
                 NativeMethods.STATSTG pStatstg,
                 int grfStatFlag);
 
        [return: MarshalAs(UnmanagedType.Interface)]
          UnsafeNativeMethods.IStream Clone();
    }
 
    public abstract class CharBuffer
    {
 
        public static CharBuffer CreateBuffer(int size)
        {
            if (Marshal.SystemDefaultCharSize == 1)
            {
                return new AnsiCharBuffer(size);
            }
            return new UnicodeCharBuffer(size);
        }
 
        public abstract IntPtr AllocCoTaskMem();
        public abstract string GetString();
        public abstract void PutCoTaskMem(IntPtr ptr);
        public abstract void PutString(string s);
    }
 
    public class AnsiCharBuffer : CharBuffer
    {
 
        internal byte[] buffer;
        internal int offset;
 
        public AnsiCharBuffer(int size)
        {
            buffer = new byte[size];
        }
 
        public override IntPtr AllocCoTaskMem()
        {
            IntPtr result = Marshal.AllocCoTaskMem(buffer.Length);
            Marshal.Copy(buffer, 0, result, buffer.Length);
            return result;
        }
 
        public override string GetString()
        {
            int i = offset;
            while (i < buffer.Length && buffer[i] != 0)
                i++;
            string result = Encoding.Default.GetString(buffer, offset, i - offset);
            if (i < buffer.Length)
                i++;
            offset = i;
            return result;
        }
 
        public override void PutCoTaskMem(IntPtr ptr)
        {
            Marshal.Copy(ptr, buffer, 0, buffer.Length);
            offset = 0;
        }
 
        public override void PutString(string s)
        {
            byte[] bytes = Encoding.Default.GetBytes(s);
            int count = Math.Min(bytes.Length, buffer.Length - offset);
            Array.Copy(bytes, 0, buffer, offset, count);
            offset += count;
            if (offset < buffer.Length) buffer[offset++] = 0;
        }
    }
 
    public class UnicodeCharBuffer : CharBuffer
    {
 
        internal char[] buffer;
        internal int offset;
 
        public UnicodeCharBuffer(int size)
        {
            buffer = new char[size];
        }
 
        public override IntPtr AllocCoTaskMem()
        {
            IntPtr result = Marshal.AllocCoTaskMem(buffer.Length * 2);
            Marshal.Copy(buffer, 0, result, buffer.Length);
            return result;
        }
 
        public override String GetString()
        {
            int i = offset;
            while (i < buffer.Length && buffer[i] != 0) i++;
            string result = new string(buffer, offset, i - offset);
            if (i < buffer.Length) i++;
            offset = i;
            return result;
        }
 
        public override void PutCoTaskMem(IntPtr ptr)
        {
            Marshal.Copy(ptr, buffer, 0, buffer.Length);
            offset = 0;
        }
 
        public override void PutString(string s)
        {
            int count = Math.Min(s.Length, buffer.Length - offset);
            s.CopyTo(0, buffer, offset, count);
            offset += count;
            if (offset < buffer.Length) buffer[offset++] = (char)0;
        }
    }
 
    public class ComStreamFromDataStream : IStream {
        protected Stream dataStream;
 
        // to support seeking ahead of the stream length...
        private long virtualPosition = -1;
 
 
        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        public ComStreamFromDataStream(Stream dataStream)
        {
            if (dataStream == null) throw new ArgumentNullException("dataStream");
            this.dataStream = dataStream;
        }
 
        private void ActualizeVirtualPosition() {
            if (virtualPosition == -1) return;
            
            if (virtualPosition > dataStream.Length)
                dataStream.SetLength(virtualPosition);
            
            dataStream.Position = virtualPosition;
            
            virtualPosition = -1;
        }
 
        public IStream Clone() {
            NotImplemented();
            return null;
        }
 
        public void Commit(int grfCommitFlags) {
            dataStream.Flush();
            // Extend the length of the file if needed.
            ActualizeVirtualPosition();
        }
 
        public long CopyTo(IStream pstm, long cb, long[] pcbRead) {
            int bufsize = 4096; // one page
            IntPtr buffer = Marshal.AllocHGlobal(bufsize);
            if (buffer == IntPtr.Zero) throw new OutOfMemoryException();
            long written = 0;
            try {
                while (written < cb) {
                    int toRead = bufsize;
                    if (written + toRead > cb) toRead  = (int) (cb - written);
                    int read = Read(buffer, toRead);
                    if (read == 0) break;
                    if (pstm.Write(buffer, read) != read) {
                        throw EFail("Wrote an incorrect number of bytes");
                    }
                    written += read;
                }
            }
            finally {
                Marshal.FreeHGlobal(buffer);
            }
            if (pcbRead != null && pcbRead.Length > 0) {
                pcbRead[0] = written;
            }
 
            return written;
        }
 
        public Stream GetDataStream() {
            return dataStream;
        }
 
        public void LockRegion(long libOffset, long cb, int dwLockType) {
        }
 
        protected static ExternalException EFail(string msg) {
            ExternalException e = new ExternalException(msg, NativeMethods.E_FAIL);
            throw e;
        }
        
        protected static void NotImplemented() {
            ExternalException e = new ExternalException(SR.GetString(SR.UnsafeNativeMethodsNotImplemented), NativeMethods.E_NOTIMPL);
            throw e;
        }
 
        public int Read(IntPtr buf, /* cpr: int offset,*/  int length) {
            //        System.Text.Out.WriteLine("IStream::Read(" + length + ")");
            byte[] buffer = new byte[length];
            int count = Read(buffer, length);
            Marshal.Copy(buffer, 0, buf, count);
            return count;
        }
 
        public int Read(byte[] buffer, /* cpr: int offset,*/  int length) {
            ActualizeVirtualPosition();
            return dataStream.Read(buffer, 0, length);
        }
 
        public void Revert() {
            NotImplemented();
        }
 
        public long Seek(long offset, int origin) {
            // Console.WriteLine("IStream::Seek("+ offset + ", " + origin + ")");
            long pos = virtualPosition;
            if (virtualPosition == -1) {
                pos = dataStream.Position;
            }
            long len = dataStream.Length;
            switch (origin) {
                case NativeMethods.STREAM_SEEK_SET:
                    if (offset <= len) {
                        dataStream.Position = offset;
                        virtualPosition = -1;
                    }
                    else {
                        virtualPosition = offset;
                    }
                    break;
                case NativeMethods.STREAM_SEEK_END:
                    if (offset <= 0) {
                        dataStream.Position = len + offset;
                        virtualPosition = -1;
                    }
                    else {
                        virtualPosition = len + offset;
                    }
                    break;
                case NativeMethods.STREAM_SEEK_CUR:
                    if (offset+pos <= len) {
                        dataStream.Position = pos + offset;
                        virtualPosition = -1;
                    }
                    else {
                        virtualPosition = offset + pos;
                    }
                    break;
            }
            if (virtualPosition != -1) {
                return virtualPosition;
            }
            else {
                return dataStream.Position;
            }
        }
 
        public void SetSize(long value) {
            dataStream.SetLength(value);
        }
 
        public void Stat(NativeMethods.STATSTG pstatstg, int grfStatFlag) {
            pstatstg.type = 2; // STGTY_STREAM
            pstatstg.cbSize = dataStream.Length;
            pstatstg.grfLocksSupported = 2; //LOCK_EXCLUSIVE
        }
 
        public void UnlockRegion(long libOffset, long cb, int dwLockType) {
        }
 
        public int Write(IntPtr buf, /* cpr: int offset,*/ int length) {
            byte[] buffer = new byte[length];
            Marshal.Copy(buf, buffer, 0, length);
            return Write(buffer, length);
        }
 
        public int Write(byte[] buffer, /* cpr: int offset,*/ int length) {
            ActualizeVirtualPosition();
            dataStream.Write(buffer, 0, length);
            return length;
        }
    }
    [ComImport(), Guid("0000000B-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStorage {
 
        [return: MarshalAs(UnmanagedType.Interface)]
          UnsafeNativeMethods.IStream CreateStream(
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsName,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int grfMode,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int reserved1,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int reserved2);
 
        [return: MarshalAs(UnmanagedType.Interface)]
          UnsafeNativeMethods.IStream OpenStream(
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsName,
 
                 IntPtr reserved1,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int grfMode,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int reserved2);
 
        [return: MarshalAs(UnmanagedType.Interface)]
          UnsafeNativeMethods.IStorage CreateStorage(
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsName,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int grfMode,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int reserved1,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int reserved2);
 
        [return: MarshalAs(UnmanagedType.Interface)]
          UnsafeNativeMethods.IStorage OpenStorage(
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsName,
 
                 IntPtr pstgPriority,   // must be null
                [In, MarshalAs(UnmanagedType.U4)] 
                 int grfMode,
 
                 IntPtr snbExclude,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int reserved);
 
        
         void CopyTo(
 
                 int ciidExclude,
                [In, MarshalAs(UnmanagedType.LPArray)] 
                 Guid[] pIIDExclude,
 
                 IntPtr snbExclude,
                [In, MarshalAs(UnmanagedType.Interface)] 
                 UnsafeNativeMethods.IStorage stgDest);
 
        
         void MoveElementTo(
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsName,
                [In, MarshalAs(UnmanagedType.Interface)] 
                 UnsafeNativeMethods.IStorage stgDest,
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsNewName,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int grfFlags);
 
        
         void Commit(
 
                 int grfCommitFlags);
 
        
         void Revert();
 
        
         void EnumElements(
                [In, MarshalAs(UnmanagedType.U4)] 
                 int reserved1,
                     // void *
                 IntPtr reserved2,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int reserved3,
                [Out, MarshalAs(UnmanagedType.Interface)]
                 out object ppVal);                     // IEnumSTATSTG
 
        
         void DestroyElement(
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsName);
 
        
         void RenameElement(
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsOldName,
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsNewName);
 
        
         void SetElementTimes(
                [In, MarshalAs(UnmanagedType.BStr)] 
                 string pwcsName,
                [In] 
                 NativeMethods.FILETIME pctime,
                [In] 
                 NativeMethods.FILETIME patime,
                [In] 
                 NativeMethods.FILETIME pmtime);
 
        
         void SetClass(
                [In] 
                 ref Guid clsid);
 
        
         void SetStateBits(
 
                 int grfStateBits,
 
                 int grfMask);
 
        
         void Stat(
                [Out] 
                 NativeMethods.STATSTG pStatStg,
                 int grfStatFlag);
    }
 
    [ComImport(), Guid("B196B28F-BAB4-101A-B69C-00AA00341D07"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IClassFactory2 {
 
        
         void CreateInstance(
                [In, MarshalAs(UnmanagedType.Interface)] 
                  object unused,
                        [In]
                  ref Guid refiid,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                  object[] ppunk);
 
        
         void LockServer(
 
                 int fLock);
 
        
         void GetLicInfo(
                [Out] 
                  NativeMethods.tagLICINFO licInfo);
 
        
         void RequestLicKey(
                [In, MarshalAs(UnmanagedType.U4)] 
                 int dwReserved,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   string[] pBstrKey);
 
        
         void CreateInstanceLic(
                [In, MarshalAs(UnmanagedType.Interface)] 
                  object pUnkOuter,
                [In, MarshalAs(UnmanagedType.Interface)] 
                  object pUnkReserved,
                        [In]
                  ref Guid riid,
                [In, MarshalAs(UnmanagedType.BStr)] 
                  string bstrKey,
                [Out, MarshalAs(UnmanagedType.Interface)]
                  out object ppVal);
    }
    [SuppressUnmanagedCodeSecurity, ComImport(),
    Guid("B196B284-BAB4-101A-B69C-00AA00341D07"),
    InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IConnectionPointContainer {
 
        [return: MarshalAs(UnmanagedType.Interface)]
          object EnumConnectionPoints();
 
        [PreserveSig]
        int FindConnectionPoint([In] ref Guid guid, [Out, MarshalAs(UnmanagedType.Interface)]out IConnectionPoint ppCP);
 
    }
 
    [ComImport(), Guid("B196B285-BAB4-101A-B69C-00AA00341D07"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IEnumConnectionPoints {
        [PreserveSig]
        int Next(int cConnections, out IConnectionPoint pCp, out int pcFetched);
        
        [PreserveSig]
        int Skip(int cSkip);
 
        void Reset();
 
        IEnumConnectionPoints Clone();
    }
 
 
    [ComImport(), Guid("00020400-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDispatch {
         int GetTypeInfoCount();
 
        [return: MarshalAs(UnmanagedType.Interface)]
         ITypeInfo GetTypeInfo(
                [In, MarshalAs(UnmanagedType.U4)] 
                 int iTInfo,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int lcid);
 
 
         [PreserveSig]
         int GetIDsOfNames(
                [In]
                 ref Guid riid,
                [In, MarshalAs(UnmanagedType.LPArray)] 
                 string[] rgszNames,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int cNames,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int lcid,
                [Out, MarshalAs(UnmanagedType.LPArray)]
                 int[] rgDispId);
 
 
         [PreserveSig]
         int Invoke(
 
                 int dispIdMember,
                [In] 
                 ref Guid riid,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int lcid,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int dwFlags,
                [Out, In] 
                  NativeMethods.tagDISPPARAMS pDispParams,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                  object[] pVarResult,
                [Out, In] 
                  NativeMethods.tagEXCEPINFO pExcepInfo,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                  IntPtr [] pArgErr);
 
    }
 
    [ComImport(), Guid("00020401-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface  ITypeInfo {
            [PreserveSig]
            int GetTypeAttr(ref IntPtr pTypeAttr);
 
 
            [PreserveSig]
            int GetTypeComp(
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                       UnsafeNativeMethods.ITypeComp[] ppTComp);
 
 
            [PreserveSig]
            int GetFuncDesc(
                    [In, MarshalAs(UnmanagedType.U4)] 
                     int index, ref IntPtr pFuncDesc);
 
 
             [PreserveSig]
             int GetVarDesc(
                    [In, MarshalAs(UnmanagedType.U4)] 
                     int index, ref IntPtr pVarDesc);
 
 
             [PreserveSig]
             int GetNames(
 
                     int memid,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      string[] rgBstrNames,
                    [In, MarshalAs(UnmanagedType.U4)] 
                     int cMaxNames,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      int[] pcNames);
 
 
            [PreserveSig]
            int GetRefTypeOfImplType(
                    [In, MarshalAs(UnmanagedType.U4)] 
                     int index,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      int[] pRefType);
 
 
            [PreserveSig]
            int GetImplTypeFlags(
                    [In, MarshalAs(UnmanagedType.U4)] 
                     int index,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      int[] pImplTypeFlags);
 
 
            [PreserveSig]
            int GetIDsOfNames(IntPtr rgszNames, int cNames, IntPtr pMemId);
 
 
            [PreserveSig]
            int Invoke();
 
 
            [PreserveSig]
            int GetDocumentation(
 
                     int memid,
                      ref string pBstrName,
                      ref string pBstrDocString,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      int[] pdwHelpContext,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      string[] pBstrHelpFile);
 
 
            [PreserveSig]
            int GetDllEntry(
 
                     int memid,
 
                      NativeMethods.tagINVOKEKIND invkind,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      string[] pBstrDllName,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      string[] pBstrName,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      short[] pwOrdinal);
 
 
             [PreserveSig]
             int GetRefTypeInfo(
 
                     IntPtr hreftype,
                     ref ITypeInfo pTypeInfo);
 
 
            [PreserveSig]
            int AddressOfMember();
 
 
            [PreserveSig]
            int CreateInstance(
                    [In] 
                      ref Guid riid,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      object[] ppvObj);
 
 
             [PreserveSig]
             int GetMops(
 
                     int memid,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                     string[] pBstrMops);
 
 
            [PreserveSig]
            int GetContainingTypeLib(
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                       UnsafeNativeMethods.ITypeLib[] ppTLib,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                      int[] pIndex);
 
             [PreserveSig]
             void ReleaseTypeAttr(IntPtr typeAttr);
 
             [PreserveSig]
             void ReleaseFuncDesc(IntPtr funcDesc);
 
             [PreserveSig]
             void ReleaseVarDesc(IntPtr varDesc);
 
    }
    [ComImport(), Guid("00020403-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface  ITypeComp {
         void RemoteBind(
                [In, MarshalAs(UnmanagedType.LPWStr)] 
                 string szName,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int lHashVal,
                [In, MarshalAs(UnmanagedType.U2)] 
                 short wFlags,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   UnsafeNativeMethods.ITypeInfo[] ppTInfo,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                  NativeMethods.tagDESCKIND[] pDescKind,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   NativeMethods.tagFUNCDESC[] ppFuncDesc,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   NativeMethods.tagVARDESC[] ppVarDesc,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   UnsafeNativeMethods.ITypeComp[] ppTypeComp,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                  int[] pDummy);
 
        
         void RemoteBindType(
                [In, MarshalAs(UnmanagedType.LPWStr)] 
                 string szName,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int lHashVal,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   UnsafeNativeMethods.ITypeInfo[] ppTInfo);
 
    }
 
    [ComImport(), Guid("00020402-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface  ITypeLib {
 
         void RemoteGetTypeInfoCount(
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                  int[] pcTInfo);
 
        
         void GetTypeInfo(
                [In, MarshalAs(UnmanagedType.U4)] 
                 int index,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   UnsafeNativeMethods.ITypeInfo[] ppTInfo);
 
        
         void GetTypeInfoType(
                [In, MarshalAs(UnmanagedType.U4)] 
                 int index,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                  NativeMethods.tagTYPEKIND[] pTKind);
 
        
         void GetTypeInfoOfGuid(
                [In] 
                  ref Guid guid,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   UnsafeNativeMethods.ITypeInfo[] ppTInfo);
 
        
         void RemoteGetLibAttr(
                IntPtr ppTLibAttr,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                  int[] pDummy);
 
        
         void GetTypeComp(
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                   UnsafeNativeMethods.ITypeComp[] ppTComp);
 
        
         void RemoteGetDocumentation(
                 
                 int index,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int refPtrFlags,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 string[] pBstrName,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 string[] pBstrDocString,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 int[] pdwHelpContext,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 string[] pBstrHelpFile);
 
        
         void RemoteIsName(
                [In, MarshalAs(UnmanagedType.LPWStr)] 
                 string szNameBuf,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int lHashVal,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 IntPtr [] pfName,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 string[] pBstrLibName);
 
        
         void RemoteFindName(
                [In, MarshalAs(UnmanagedType.LPWStr)] 
                 string szNameBuf,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int lHashVal,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 UnsafeNativeMethods.ITypeInfo[] ppTInfo,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 int[] rgMemId,
                [In, Out, MarshalAs(UnmanagedType.LPArray)] 
                 short[] pcFound,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 string[] pBstrLibName);
 
        
         void LocalReleaseTLibAttr();
    }
 
    [ComImport(), 
     Guid("DF0B3D60-548F-101B-8E65-08002B2BD119"), 
     InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ISupportErrorInfo {
 
        int InterfaceSupportsErrorInfo(
                [In] ref Guid riid);
 
 
    }
 
    [ComImport(), 
     Guid("1CF2B120-547D-101B-8E65-08002B2BD119"), 
     InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IErrorInfo {
 
        [ System.Security.SuppressUnmanagedCodeSecurityAttribute()]
        [PreserveSig]
        int GetGUID(
                   [Out]
                   out Guid pguid);
 
        [ System.Security.SuppressUnmanagedCodeSecurityAttribute()]
        [PreserveSig]
        int GetSource(
                     [In, Out, MarshalAs(UnmanagedType.BStr)] 
                     ref string pBstrSource);
 
        [ System.Security.SuppressUnmanagedCodeSecurityAttribute()]
        [PreserveSig]
        int GetDescription(
                          [In, Out, MarshalAs(UnmanagedType.BStr)] 
                          ref string pBstrDescription);
 
        [ System.Security.SuppressUnmanagedCodeSecurityAttribute()]
        [PreserveSig]
        int GetHelpFile(
                       [In, Out, MarshalAs(UnmanagedType.BStr)] 
                       ref string pBstrHelpFile);
 
        [ System.Security.SuppressUnmanagedCodeSecurityAttribute()]
        [PreserveSig]
        int GetHelpContext(
                          [In, Out, MarshalAs(UnmanagedType.U4)] 
                          ref int pdwHelpContext);
 
    }
 
    [StructLayout(LayoutKind.Sequential)]
    public sealed class tagQACONTAINER
    {
      [MarshalAs(UnmanagedType.U4)]
      public int cbSize = Marshal.SizeOf(typeof(tagQACONTAINER));
 
      public UnsafeNativeMethods.IOleClientSite pClientSite;
 
      [MarshalAs(UnmanagedType.Interface)]
      public object pAdviseSink = null;
 
      public UnsafeNativeMethods.IPropertyNotifySink pPropertyNotifySink;
 
      [MarshalAs(UnmanagedType.Interface)]
      public object pUnkEventSink = null;
 
      [MarshalAs(UnmanagedType.U4)]
      public int dwAmbientFlags;
 
      [MarshalAs(UnmanagedType.U4)]
      public UInt32 colorFore;
 
      [MarshalAs(UnmanagedType.U4)]
      public UInt32 colorBack;
 
      [MarshalAs(UnmanagedType.Interface)]
      public object pFont;
 
      [MarshalAs(UnmanagedType.Interface)]
      public object pUndoMgr = null;
 
      [MarshalAs(UnmanagedType.U4)]
      public int dwAppearance;
 
      public int lcid;
 
      public IntPtr hpal = IntPtr.Zero;
 
      [MarshalAs(UnmanagedType.Interface)]
      public object pBindHost = null;
    
      // visual basic6 uses a old version of the struct that is missing these two fields.
      // So, ActiveX sourcing does not work, with the EE trying to read off the
      // end of the stack to get to these variables. If I do not define these,
      // Office or any of the other hosts will hopefully get nulls, otherwise they
      // will crash.
      //
      //public UnsafeNativeMethods.IOleControlSite pControlSite;
    
      //public UnsafeNativeMethods.IOleServiceProvider pServiceProvider;
    }
 
    [StructLayout(LayoutKind.Sequential)/*leftover(noAutoOffset)*/]
    public sealed class tagQACONTROL
    {
      [MarshalAs(UnmanagedType.U4)/*leftover(offset=0, cbSize)*/]
      public int cbSize = Marshal.SizeOf(typeof(tagQACONTROL));
 
      [MarshalAs(UnmanagedType.U4)/*leftover(offset=4, dwMiscStatus)*/]
      public int dwMiscStatus = 0;
 
      [MarshalAs(UnmanagedType.U4)/*leftover(offset=8, dwViewStatus)*/]
      public int dwViewStatus = 0;
 
      [MarshalAs(UnmanagedType.U4)/*leftover(offset=12, dwEventCookie)*/]
      public int dwEventCookie = 0;
 
      [MarshalAs(UnmanagedType.U4)/*leftover(offset=16, dwPropNotifyCookie)*/]
      public int dwPropNotifyCookie = 0;
 
      [MarshalAs(UnmanagedType.U4)/*leftover(offset=20, dwPointerActivationPolicy)*/]
      public int dwPointerActivationPolicy = 0;
 
    }
 
    [SecurityCritical(SecurityCriticalScope.Everything)]
    [ComImport()]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [Guid("E44C3566-915D-4070-99C6-047BFF5A08F5")]
    [ComVisible(true)]
    public interface ILegacyIAccessibleProvider {
 
        void Select(int flagsSelect);
 
        void DoDefaultAction();
 
        void SetValue([MarshalAs(UnmanagedType.LPWStr)] string szValue);
 
        [return: MarshalAs(UnmanagedType.Interface)]
        Accessibility.IAccessible GetIAccessible();
 
        int ChildId { get; }
 
        string Name { get; }
 
        string Value { get; }
 
        string Description { get; }
 
        uint Role { get; }
 
        uint State { get; }
 
        string Help { get; }
 
        string KeyboardShortcut { get; }
 
        object[] /* IRawElementProviderSimple[] */ GetSelection();
 
        string DefaultAction { get; }
    }
 
    [ComImport(), Guid("0000000A-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ILockBytes {
 
        
         void ReadAt(
                [In, MarshalAs(UnmanagedType.U8)] 
                 long ulOffset,
                [Out] 
                 IntPtr pv,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int cb,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 int[] pcbRead);
 
        
         void WriteAt(
                [In, MarshalAs(UnmanagedType.U8)] 
                 long ulOffset,
 
                 IntPtr pv,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int cb,
                [Out, MarshalAs(UnmanagedType.LPArray)] 
                 int[] pcbWritten);
 
        
         void Flush();
 
        
         void SetSize(
                [In, MarshalAs(UnmanagedType.U8)] 
                 long cb);
 
        
         void LockRegion(
                [In, MarshalAs(UnmanagedType.U8)] 
                 long libOffset,
                [In, MarshalAs(UnmanagedType.U8)] 
                 long cb,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int dwLockType);
 
        
         void UnlockRegion(
                [In, MarshalAs(UnmanagedType.U8)] 
                 long libOffset,
                [In, MarshalAs(UnmanagedType.U8)] 
                 long cb,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int dwLockType);
 
        
         void Stat(
                [Out] 
                  NativeMethods.STATSTG pstatstg,
                [In, MarshalAs(UnmanagedType.U4)] 
                 int grfStatFlag);
 
    }
 
    [StructLayout(LayoutKind.Sequential),
        SuppressUnmanagedCodeSecurity()]
    public class OFNOTIFY
    {
        // hdr was a by-value NMHDR structure
        public IntPtr hdr_hwndFrom = IntPtr.Zero;
        public IntPtr hdr_idFrom = IntPtr.Zero;
        public int  hdr_code = 0;
    
        public IntPtr lpOFN = IntPtr.Zero;
        public IntPtr pszFile = IntPtr.Zero;
    }
 
    internal static bool IsComObject(object o)
    {
        return Marshal.IsComObject(o);
    }
 
    internal static int ReleaseComObject(object objToRelease)
    {
        return Marshal.ReleaseComObject(objToRelease);
    }
            
    [ReflectionPermission(SecurityAction.Assert, Unrestricted=true)]
    public static object PtrToStructure(IntPtr lparam, Type cls) {
        return Marshal.PtrToStructure(lparam, cls);
    }
    
    [ReflectionPermission(SecurityAction.Assert, Unrestricted=true)]
    public static void PtrToStructure(IntPtr lparam, object data) {
        Marshal.PtrToStructure(lparam, data);
    }
 
        internal static int SizeOf(Type t)
        {
            return Marshal.SizeOf(t);
        }
 
        internal static void ThrowExceptionForHR(int errorCode)
        {
            Marshal.ThrowExceptionForHR(errorCode);
        }
 
 
        public delegate int BrowseCallbackProc(
            IntPtr hwnd,
            int msg, 
            IntPtr lParam, 
            IntPtr lpData);
 
        [Flags]    
        public enum BrowseInfos
        {
            NewDialogStyle      = 0x0040,   // Use the new dialog layout with the ability to resize
            HideNewFolderButton = 0x0200    // Don't display the 'New Folder' button
        }
 
        [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
        public class BROWSEINFO 
        {
            [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
            public IntPtr hwndOwner; //HWND hwndOwner; // HWND of the owner for the dialog
            [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
            public IntPtr pidlRoot; //LPCITEMIDLIST pidlRoot; // Root ITEMIDLIST
    
            // For interop purposes, send over a buffer of MAX_PATH size. 
            [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
            public IntPtr pszDisplayName; //LPWSTR pszDisplayName; // Return display name of item selected.
    
            public string lpszTitle; //LPCWSTR lpszTitle; // text to go in the banner over the tree.
            public int ulFlags; //UINT ulFlags; // Flags that control the return stuff
            public BrowseCallbackProc lpfn; //BFFCALLBACK lpfn; // Call back pointer
            [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
            public IntPtr lParam; //LPARAM lParam; // extra info that's passed back in callbacks
            public int iImage; //int iImage; // output var: where to return the Image index.
        }
 
        [SuppressUnmanagedCodeSecurity(), 
            SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
        internal class Shell32 
        {
            [DllImport(ExternDll.Shell32)]
            [ResourceExposure(ResourceScope.None)]
            public static extern int SHGetSpecialFolderLocation(IntPtr hwnd, int csidl, ref IntPtr ppidl);
            //SHSTDAPI SHGetSpecialFolderLocation(HWND hwnd, int csidl, LPITEMIDLIST *ppidl);
 
            [DllImport(ExternDll.Shell32, CharSet = CharSet.Auto)]
            [ResourceExposure(ResourceScope.None)]
            private static extern bool SHGetPathFromIDListEx(IntPtr pidl, IntPtr pszPath, int cchPath, int flags);
            //SHSTDAPI_(BOOL) SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath);
 
            public static bool SHGetPathFromIDListLongPath(IntPtr pidl, ref IntPtr pszPath)
            {
                int noOfTimes = 1;
                // This is how size was allocated in the calling method.
                int bufferSize = NativeMethods.MAX_PATH * Marshal.SystemDefaultCharSize;
                int length = NativeMethods.MAX_PATH;
                bool result = false;
 
                // SHGetPathFromIDListEx returns false in case of insufficient buffer.
                // This method does not distinguish between insufficient memory and an error. Until we get a proper solution,
                // this logic would work. In the worst case scenario, loop exits when length reaches unicode string length.
                while ((result = SHGetPathFromIDListEx(pidl, pszPath, length, 0)) == false 
                        && length < NativeMethods.MAX_UNICODESTRING_LEN)
                {
                    string path = Marshal.PtrToStringAuto(pszPath);
 
                    if (path.Length != 0 && path.Length < length)
                        break;
 
                    noOfTimes += 2; //520 chars capacity increase in each iteration.
                    length = noOfTimes * length >= NativeMethods.MAX_UNICODESTRING_LEN 
                        ? NativeMethods.MAX_UNICODESTRING_LEN : noOfTimes * length;
                    pszPath = Marshal.ReAllocHGlobal(pszPath, (IntPtr)((length + 1) * Marshal.SystemDefaultCharSize));
                }
 
                return result;
            }
            
            [DllImport(ExternDll.Shell32, CharSet=CharSet.Auto)]
            [ResourceExposure(ResourceScope.None)]
            public static extern IntPtr SHBrowseForFolder([In] BROWSEINFO lpbi);        
            //SHSTDAPI_(LPITEMIDLIST) SHBrowseForFolderW(LPBROWSEINFOW lpbi);
              
            [DllImport(ExternDll.Shell32)]
            [ResourceExposure(ResourceScope.None)]
            public static extern int SHGetMalloc([Out, MarshalAs(UnmanagedType.LPArray)] UnsafeNativeMethods.IMalloc[] ppMalloc);
            //SHSTDAPI SHGetMalloc(LPMALLOC * ppMalloc);
 
            [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")]
            [DllImport(ExternDll.Shell32, PreserveSig = true)]
            [ResourceExposure(ResourceScope.None)]
            private static extern int SHGetKnownFolderPath(ref Guid rfid, uint dwFlags, IntPtr hToken, out IntPtr pszPath);
 
            public static int SHGetFolderPathEx(ref Guid rfid, uint dwFlags, IntPtr hToken, StringBuilder pszPath)
            {                
                if (IsVista)
                {
                    IntPtr path = IntPtr.Zero;
                    int result = -1;
                    if ((result = SHGetKnownFolderPath(ref rfid, dwFlags, hToken, out path)) == NativeMethods.S_OK)
                    {
                        pszPath.Append(Marshal.PtrToStringAuto(path));
                        CoTaskMemFree(path);
                    }
                    return result;
                }
                throw new NotSupportedException();
            }
 
            [DllImport(ExternDll.Shell32, PreserveSig = true)]
            [ResourceExposure(ResourceScope.None)]
            public static extern int SHCreateShellItem(IntPtr pidlParent, IntPtr psfParent, IntPtr pidl, out FileDialogNative.IShellItem ppsi);
 
            [DllImport(ExternDll.Shell32, PreserveSig = true)]
            [ResourceExposure(ResourceScope.None)]
            public static extern int SHILCreateFromPath([MarshalAs(UnmanagedType.LPWStr)]string pszPath, out IntPtr ppIdl, ref uint rgflnOut);
        }
 
        [
        ComImport(), 
        Guid("00000002-0000-0000-c000-000000000046"), 
        System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown),
        SuppressUnmanagedCodeSecurity()
        ]
        public interface IMalloc 
        {
            [PreserveSig]
            IntPtr Alloc(int cb);
 
            [PreserveSig]
            IntPtr Realloc(IntPtr pv, int cb);
 
            [PreserveSig]
            void Free(IntPtr pv);
 
            [PreserveSig]
            int GetSize(IntPtr pv);
 
            [PreserveSig]
            int DidAlloc(IntPtr pv);
 
            [PreserveSig]
            void HeapMinimize();
        }
 
          [
          ComImport,
          Guid("00000126-0000-0000-C000-000000000046"),
          InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
          ]
          public interface IRunnableObject 
          {
               void GetRunningClass(out Guid guid);
 
               [PreserveSig]
               int Run(IntPtr lpBindContext);
               bool IsRunning();
               void LockRunning(bool fLock, bool fLastUnlockCloses);
               void SetContainedObject(bool fContained);          
          }
 
        [ComVisible(true), ComImport(), Guid("B722BCC7-4E68-101B-A2BC-00AA00404770"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
               public interface IOleDocumentSite 
          {
    
               [return: MarshalAs(UnmanagedType.I4)]
               [PreserveSig]
               int ActivateMe(
                    [In, MarshalAs(UnmanagedType.Interface)] 
                    IOleDocumentView pViewToActivate);
    
          }
 
          [ComVisible(true), Guid("B722BCC6-4E68-101B-A2BC-00AA00404770"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
               public interface IOleDocumentView 
          {
    
               void SetInPlaceSite(
                    [In, MarshalAs(UnmanagedType.Interface)] 
                    IOleInPlaceSite pIPSite);
    
               [return: MarshalAs(UnmanagedType.Interface)]
               IOleInPlaceSite GetInPlaceSite();
    
               [return: MarshalAs(UnmanagedType.Interface)]
               object GetDocument();
    
             
               void SetRect(
                    [In] 
                    ref NativeMethods.RECT prcView);
    
             
               void GetRect(
                    [In, Out] 
                    ref NativeMethods.RECT prcView);
    
             
               void SetRectComplex(
                    [In] 
                    NativeMethods.RECT prcView,
                    [In] 
                    NativeMethods.RECT prcHScroll,
                    [In] 
                    NativeMethods.RECT prcVScroll,
                    [In] 
                    NativeMethods.RECT prcSizeBox);
    
             
               void Show(bool fShow);
    
             
               [PreserveSig]
               int UIActivate(bool fUIActivate);
    
             
               void Open();
    
               [PreserveSig]
               int Close(
                    [In, MarshalAs(UnmanagedType.U4)] 
                    int dwReserved);
    
             
               void SaveViewState(
                    [In, MarshalAs(UnmanagedType.Interface)] 
                    IStream pstm);
    
             
               void ApplyViewState(
                    [In, MarshalAs(UnmanagedType.Interface)] 
                    IStream pstm);
    
             
               void Clone(
                    [In, MarshalAs(UnmanagedType.Interface)] 
                    IOleInPlaceSite pIPSiteNew,
                    [Out, MarshalAs(UnmanagedType.LPArray)] 
                    IOleDocumentView[] ppViewNew);
    
    
          }
 
        [
          ComImport,
          Guid("b722bcc5-4e68-101b-a2bc-00aa00404770"),
          InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
          ]
          public interface IOleDocument 
          {
               
               [PreserveSig]
               int CreateView(IOleInPlaceSite pIPSite,
                                   IStream pstm,
                                             int dwReserved,
                                             out IOleDocumentView ppView);
 
               [PreserveSig]
               int GetDocMiscStatus(
                    out int pdwStatus);
 
               int EnumViews(
                    out object ppEnum,
                    out IOleDocumentView ppView);
          }
 
        [
            Guid("0000011e-0000-0000-C000-000000000046"),  ComImport, InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)
        ]
        public interface IOleCache
        {
            int Cache(ref FORMATETC pformatetc,int advf);
    
            void Uncache(int  dwConnection);
            
            object EnumCache(/*[out] IEnumSTATDATA **ppenumSTATDATA*/);
        
            void InitCache(IComDataObject pDataObject);
    
            void SetData(ref FORMATETC pformatetc, ref STGMEDIUM pmedium, bool fRelease);
        }
 
 
        
       
 
        [ComImport,
         TypeLibType(0x1050),
         Guid("618736E0-3C3D-11CF-810C-00AA00389B71"),
        ]
        public interface IAccessibleInternal {
            [return: MarshalAs(UnmanagedType.IDispatch)]
            [DispId(unchecked((int)0xFFFFEC78))]
            [TypeLibFunc(0x0040)]
            object get_accParent();
    
            [DispId(unchecked((int)0xFFFFEC77))]
            [TypeLibFunc(0x0040)]
            int get_accChildCount();
    
            [return: MarshalAs(UnmanagedType.IDispatch)]
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC76))]
            object get_accChild([In][MarshalAs(UnmanagedType.Struct)] object varChild);
    
            [return: MarshalAs(UnmanagedType.BStr)]
            [DispId(unchecked((int)0xFFFFEC75))]
            [TypeLibFunc(0x0040)]
            string get_accName([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
    
            [return: MarshalAs(UnmanagedType.BStr)]
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC74))]
            string get_accValue([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
 
            [return: MarshalAs(UnmanagedType.BStr)]
            [DispId(unchecked((int)0xFFFFEC73))]
            [TypeLibFunc(0x0040)]
            string get_accDescription([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
 
            [return: MarshalAs(UnmanagedType.Struct)]
            [DispId(unchecked((int)0xFFFFEC72))]
            [TypeLibFunc(0x0040)]
            object get_accRole([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
 
            [return: MarshalAs(UnmanagedType.Struct)]
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC71))]
            object get_accState([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
 
            [return: MarshalAs(UnmanagedType.BStr)]
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC70))]
            string get_accHelp([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
 
            [DispId(unchecked((int)0xFFFFEC6F))]
            [TypeLibFunc(0x0040)]
            int get_accHelpTopic([Out][MarshalAs(UnmanagedType.BStr)] out string pszHelpFile,
                                                        [In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
 
            [return: MarshalAs(UnmanagedType.BStr)]
            [DispId(unchecked((int)0xFFFFEC6E))]
            [TypeLibFunc(0x0040)]
            string get_accKeyboardShortcut([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
 
            [return: MarshalAs(UnmanagedType.Struct)]
            [DispId(unchecked((int)0xFFFFEC6D))]
            [TypeLibFunc(0x0040)]
            object get_accFocus();
    
            [return: MarshalAs(UnmanagedType.Struct)]
            [DispId(unchecked((int)0xFFFFEC6C))]
            [TypeLibFunc(0x0040)]
            object get_accSelection();
            
            [return: MarshalAs(UnmanagedType.BStr)]
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC6B))]
            string get_accDefaultAction([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
    
            [DispId(unchecked((int)0xFFFFEC6A))]
            [TypeLibFunc(0x0040)]
            void accSelect([In] int flagsSelect,
                           [In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
    
            [DispId(unchecked((int)0xFFFFEC69))]
            [TypeLibFunc(0x0040)]
            void accLocation([Out] out int pxLeft,
                             [Out] out int pyTop,
                             [Out] out int pcxWidth,
                             [Out] out int pcyHeight,
                             [In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
    
            [return: MarshalAs(UnmanagedType.Struct)]
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC68))]
            object accNavigate([In] int navDir,
                               [In][Optional][MarshalAs(UnmanagedType.Struct)] object varStart);
    
            [return: MarshalAs(UnmanagedType.Struct)]
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC67))]
            object accHitTest([In] int xLeft,
                              [In] int yTop);
 
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC66))]
            void accDoDefaultAction([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild);
        
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC75))]
            void set_accName([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild,
                                 [In][MarshalAs(UnmanagedType.BStr)] string pszName);
    
            [TypeLibFunc(0x0040)]
            [DispId(unchecked((int)0xFFFFEC74))]
            void set_accValue([In][Optional][MarshalAs(UnmanagedType.Struct)] object varChild,
                              [In][MarshalAs(UnmanagedType.BStr)] string pszValue);
        }
 
        [
        ComImport(),
        Guid("BEF6E002-A874-101A-8BBA-00AA00300CAB"),
        System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
        public interface IFont
        {
 
            [return: MarshalAs(UnmanagedType.BStr)]
            string GetName();
 
            void SetName(
                   [In, MarshalAs(UnmanagedType.BStr)]
                      string pname);
 
            [return: MarshalAs(UnmanagedType.U8)]
            long GetSize();
 
            void SetSize(
                   [In, MarshalAs(UnmanagedType.U8)]
                     long psize);
 
            [return: MarshalAs(UnmanagedType.Bool)]
            bool GetBold();
 
            void SetBold(
                   [In, MarshalAs(UnmanagedType.Bool)]
                     bool pbold);
 
            [return: MarshalAs(UnmanagedType.Bool)]
            bool GetItalic();
 
            void SetItalic(
                   [In, MarshalAs(UnmanagedType.Bool)]
                     bool pitalic);
 
            [return: MarshalAs(UnmanagedType.Bool)]
            bool GetUnderline();
 
            void SetUnderline(
                   [In, MarshalAs(UnmanagedType.Bool)]
                     bool punderline);
 
            [return: MarshalAs(UnmanagedType.Bool)]
            bool GetStrikethrough();
 
            void SetStrikethrough(
                   [In, MarshalAs(UnmanagedType.Bool)]
                     bool pstrikethrough);
 
            [return: MarshalAs(UnmanagedType.I2)]
            short GetWeight();
 
            void SetWeight(
                   [In, MarshalAs(UnmanagedType.I2)]
                     short pweight);
 
            [return: MarshalAs(UnmanagedType.I2)]
            short GetCharset();
 
            void SetCharset(
                   [In, MarshalAs(UnmanagedType.I2)]
                     short pcharset);
 
            IntPtr GetHFont();
 
            void Clone(
                      out UnsafeNativeMethods.IFont ppfont);
 
            [System.Runtime.InteropServices.PreserveSig]
            int IsEqual(
                   [In, MarshalAs(UnmanagedType.Interface)]
                      UnsafeNativeMethods.IFont pfontOther);
 
            void SetRatio(
                    int cyLogical,
                    int cyHimetric);
 
            void QueryTextMetrics(out IntPtr ptm);
 
            void AddRefHfont(
                    IntPtr hFont);
 
            void ReleaseHfont(
                    IntPtr hFont);
 
            void SetHdc(
                    IntPtr hdc);
        }
 
        [ComImport(), Guid("7BF80980-BF32-101A-8BBB-00AA00300CAB"), System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
        public interface IPicture
        {
            IntPtr GetHandle();
 
            IntPtr GetHPal();
 
            [return: MarshalAs(UnmanagedType.I2)]
            short GetPictureType();
 
            int GetWidth();
 
            int GetHeight();
 
            void Render(
               IntPtr hDC,
               int x,
               int y,
               int cx,
               int cy,
               int xSrc,
               int ySrc,
               int cxSrc,
               int cySrc,
               IntPtr rcBounds
               );
 
            void SetHPal(
                    IntPtr phpal);
 
            IntPtr GetCurDC();
 
            void SelectPicture(
                    IntPtr hdcIn,
                   [Out, MarshalAs(UnmanagedType.LPArray)]
                     IntPtr[] phdcOut,
                   [Out, MarshalAs(UnmanagedType.LPArray)]
                     IntPtr[] phbmpOut);
 
            [return: MarshalAs(UnmanagedType.Bool)]
            bool GetKeepOriginalFormat();
 
            void SetKeepOriginalFormat(
                   [In, MarshalAs(UnmanagedType.Bool)]
                     bool pfkeep);
 
            void PictureChanged();
 
            [PreserveSig]
            int SaveAsFile(
                   [In, MarshalAs(UnmanagedType.Interface)]
                     UnsafeNativeMethods.IStream pstm,
 
                    int fSaveMemCopy,
                   [Out]
                     out int pcbSize);
 
            int GetAttributes();
        }
 
        [ComImport(), Guid("7BF80981-BF32-101A-8BBB-00AA00300CAB"), System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIDispatch)]
        public interface IPictureDisp
        {
            IntPtr Handle { get;}
 
            IntPtr HPal { get;}
 
            short PictureType { get;}
 
            int Width { get;}
 
            int Height { get;}
 
            void Render(
                    IntPtr hdc,
                    int x,
                    int y,
                    int cx,
                    int cy,
                    int xSrc,
                    int ySrc,
                    int cxSrc,
                    int cySrc);
        }
 
        /// <include file='doc\UnsafeNativeMethods.uex' path='docs/doc[@for="UnsafeNativeMethods"]/*' />
        /// <devdoc>
        /// This class provides static methods to create, activate and deactivate the theming scope.
        /// </devdoc>
        [SuppressUnmanagedCodeSecurity]
        internal class ThemingScope
        {
            private static ACTCTX enableThemingActivationContext;
            [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
            private static IntPtr hActCtx;
            private static bool contextCreationSucceeded;
 
            /// <devdoc>
            /// We now use explicitactivate everywhere and use this method to determine if we
            /// really need to activate the activationcontext.  This should be pretty fast.
            /// </devdoc>
            [ResourceExposure(ResourceScope.None)]
            [ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
            private static bool IsContextActive()
            {
                IntPtr current = IntPtr.Zero;
 
                if (contextCreationSucceeded && GetCurrentActCtx(out current))
                {
                    return current == hActCtx;
                }
                return false;
            }
 
            /// <devdoc>
            ///     Activate() does nothing if a theming context is already active on the current thread, which is good
            ///     for perf reasons. However, in some cases, like in the Timer callback, we need to put another context
            ///     on the stack even if one is already present. In such cases, this method helps - you get to manage
            ///     the cookie yourself though.
            /// </devdoc>
            [ResourceExposure(ResourceScope.Process)]
            [ResourceConsumption(ResourceScope.Process)]
            public static IntPtr Activate()
            {
                IntPtr userCookie = IntPtr.Zero;
 
                if (Application.UseVisualStyles && contextCreationSucceeded && OSFeature.Feature.IsPresent(OSFeature.Themes))
                {
                    if (!IsContextActive())
                    {
                        if (!ActivateActCtx(hActCtx, out userCookie))
                        {
                            // Be sure cookie always zero if activation failed
                            userCookie = IntPtr.Zero;
                        }
                    }
                }
 
                return userCookie;
            }
 
            /// <devdoc>
            ///     Use this to deactivate a context activated by calling ExplicitActivate.
            /// </devdoc>
            public static IntPtr Deactivate(IntPtr userCookie)
            {
                if (userCookie != IntPtr.Zero && OSFeature.Feature.IsPresent(OSFeature.Themes))
                {
                    if (DeactivateActCtx(0, userCookie))
                    {
                        // deactivation succeeded...
                        userCookie = IntPtr.Zero;
                    }
                }
 
                return userCookie;
            }
 
            [
                // Ok to suppress because Microsoft apps cannot bleed accross different AppDomains
                // and ThemingScope class is not public so external code can't lock on typeof(ThemingScope).
                System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2002:DoNotLockOnObjectsWithWeakIdentity")
            ]
            [ResourceExposure(ResourceScope.None)]
            [ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
            public static bool CreateActivationContext(string dllPath, int nativeResourceManifestID)
            {
                lock (typeof(ThemingScope))
                {
                    if (!contextCreationSucceeded && OSFeature.Feature.IsPresent(OSFeature.Themes))
                    {
 
                        enableThemingActivationContext = new ACTCTX();
 
                        enableThemingActivationContext.cbSize = Marshal.SizeOf(typeof(ACTCTX));
                        enableThemingActivationContext.lpSource = dllPath;
                        enableThemingActivationContext.lpResourceName = (IntPtr)nativeResourceManifestID;
                        enableThemingActivationContext.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
 
                        hActCtx = CreateActCtx(ref enableThemingActivationContext);
                        contextCreationSucceeded = (hActCtx != new IntPtr(-1));
                    }
 
                    return contextCreationSucceeded;
                }
            }
 
            // All the pinvoke goo...
            [DllImport(ExternDll.Kernel32)]
            [ResourceExposure(ResourceScope.Process)]
            private extern static IntPtr CreateActCtx(ref ACTCTX actctx);
            [DllImport(ExternDll.Kernel32)]
            [ResourceExposure(ResourceScope.Process)]
            private extern static bool ActivateActCtx(IntPtr hActCtx, out IntPtr lpCookie);
            [DllImport(ExternDll.Kernel32)]
            [ResourceExposure(ResourceScope.None)]
            private extern static bool DeactivateActCtx(int dwFlags, IntPtr lpCookie);
            [DllImport(ExternDll.Kernel32)]
            [ResourceExposure(ResourceScope.Process)]
            private extern static bool GetCurrentActCtx(out IntPtr handle);
 
            private const int ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x004;
            private const int ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x008;
 
            [SuppressMessage("Microsoft.Design", "CA1049:TypesThatOwnNativeResourcesShouldBeDisposable")]
            private struct ACTCTX
            {
                public int cbSize;
                public uint dwFlags;
                public string lpSource;
                public ushort wProcessorArchitecture;
                public ushort wLangId;
                public string lpAssemblyDirectory;
                [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
                public IntPtr lpResourceName;
                public string lpApplicationName;
            }
        }
 
        // ClickOnce related interop
        [
            StructLayout(LayoutKind.Sequential),
            System.Security.SuppressUnmanagedCodeSecurityAttribute()
        ]
        internal class PROCESS_INFORMATION
        {
            [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
            public IntPtr hProcess = IntPtr.Zero;
            [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
            public IntPtr hThread = IntPtr.Zero;
            public int dwProcessId = 0;
            public int dwThreadId = 0;
 
            // Note this will guarantee we will always free the handles
            // so unless you duplicate the handles from PROCESS_INFORMATION class
            // do not close those handles.
            ~PROCESS_INFORMATION()
            {
                Close();
            }
 
            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
            internal void Close()
            {
                if (hProcess != (IntPtr)0 && hProcess != (IntPtr)INVALID_HANDLE_VALUE)
                {
                    CloseHandle(new HandleRef(this, hProcess));
                    hProcess = INVALID_HANDLE_VALUE;
                }
 
                if (hThread != (IntPtr)0 && hThread != (IntPtr)INVALID_HANDLE_VALUE)
                {
                    CloseHandle(new HandleRef(this, hThread));
                    hThread = INVALID_HANDLE_VALUE;
                }
            }
 
            [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
            private static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
 
            [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto, SetLastError=true)]
            [ResourceExposure(ResourceScope.None)]
            private static extern bool CloseHandle(HandleRef handle);
        }
 
        [DllImport(ExternDll.Clr, CharSet=CharSet.Unicode, PreserveSig=false, SetLastError=false, BestFitMapping=false, ExactSpelling=true)]
        [ResourceExposure(ResourceScope.None)]
        internal static extern void CorLaunchApplication(UInt32 hostType,
            string applicationFullName,
            int manifestPathsCount,
            string[] manifestPaths,
            int activationDataCount,
            string[] activationData,
            PROCESS_INFORMATION processInformation);
 
        // UIAutomationCore methods
 
        [DllImport(ExternDll.UiaCore, CharSet = CharSet.Unicode)]
        internal static extern int UiaHostProviderFromHwnd(HandleRef hwnd, out IRawElementProviderSimple provider);
 
        [DllImport(ExternDll.UiaCore, CharSet = CharSet.Unicode)]
        internal static extern IntPtr UiaReturnRawElementProvider(HandleRef hwnd, IntPtr wParam, IntPtr lParam, IRawElementProviderSimple el);
 
        [DllImport(ExternDll.UiaCore, CharSet = CharSet.Unicode)]
        internal static extern bool UiaClientsAreListening();
 
        [DllImport(ExternDll.UiaCore, CharSet = CharSet.Unicode, SetLastError = true)]
        internal static extern int UiaRaiseAutomationEvent(IRawElementProviderSimple provider, int id);
 
        [DllImport(ExternDll.UiaCore, CharSet = CharSet.Unicode, SetLastError = true)]
        internal static extern int UiaRaiseAutomationPropertyChangedEvent(IRawElementProviderSimple provider, int id, object oldValue, object newValue);
 
        [DllImport(ExternDll.UiaCore, CharSet = CharSet.Unicode, SetLastError = true)]
        internal static extern int UiaRaiseNotificationEvent(
            IRawElementProviderSimple provider,
            Automation.AutomationNotificationKind notificationKind,
            Automation.AutomationNotificationProcessing notificationProcessing,
            string notificationText,
            string activityId);
 
        [DllImport(ExternDll.UiaCore, CharSet = CharSet.Unicode)]
        internal static extern int UiaRaiseStructureChangedEvent(IRawElementProviderSimple provider, StructureChangeType structureChangeType, int[] runtimeId, int runtimeIdLen);
 
        // UIAutomation interfaces and enums
        // obtained from UIAutomation source code
 
        /// <summary>
        /// Logical structure change flags
        /// </summary>
        [ComVisible(true)]
        [Guid("e4cfef41-071d-472c-a65c-c14f59ea81eb")]
        public enum StructureChangeType {
            /// <summary>Logical child added</summary>
            ChildAdded,
            /// <summary>Logical child removed</summary>
            ChildRemoved,
            /// <summary>Logical children invalidated</summary>
            ChildrenInvalidated,
            /// <summary>Logical children were bulk added</summary>
            ChildrenBulkAdded,
            /// <summary>Logical children were bulk removed</summary>
            ChildrenBulkRemoved,
            /// <summary>The order of the children below their parent has changed.</summary>
            ChildrenReordered,
        }
 
        [ComVisible(true)]
        [Guid("76d12d7e-b227-4417-9ce2-42642ffa896a")]
        public enum ExpandCollapseState {
            /// <summary>No children are showing</summary>
            Collapsed,
            /// <summary>All children are showing</summary>
            Expanded,
            /// <summary>Not all children are showing</summary>
            PartiallyExpanded,
            /// <summary>Does not expand or collapse</summary>
            LeafNode
        }
 
        [Flags]
        public enum ProviderOptions {
            /// <summary>Indicates that this is a client-side provider</summary>
            ClientSideProvider = 0x0001,
            /// <summary>Indicates that this is a server-side provider</summary>
            ServerSideProvider = 0x0002,
            /// <summary>Indicates that this is a non-client-area provider</summary>
            NonClientAreaProvider = 0x0004,
            /// <summary>Indicates that this is an override provider</summary>
            OverrideProvider = 0x0008,
 
            /// <summary>Indicates that this provider handles its own focus, and does not want
            /// UIA to set focus to the nearest HWND on its behalf when AutomationElement.SetFocus
            /// is used. This option is typically used by providers for HWNDs that appear to take
            /// focus without actually receiving actual Win32 focus, such as menus and dropdowns</summary>
            ProviderOwnsSetFocus = 0x0010,
 
            /// <summary>Indicates that this provider expects to be called according to COM threading rules:
            /// if the provider is in a Single-Threaded Apartment, it will be called only on the apartment
            /// thread. Only Server-side providers can use this option.</summary>
            UseComThreading = 0x0020
        }
 
        public static readonly Guid guid_IAccessibleEx = new Guid("{F8B80ADA-2C44-48D0-89BE-5FF23C9CD875}");
 
        /// <summary>
        /// The interface representing containers that manage selection.
        /// </summary>
        /// <remarks>
        /// Client code uses this public interface; server implementers implent the
        /// ISelectionProvider public interface instead.
        /// </remarks>
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("fb8b03af-3bdf-48d4-bd36-1a65793be168")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        public interface ISelectionProvider {
            /// <summary>
            /// Get the currently selected elements
            /// </summary>
            /// <returns>An AutomationElement array containing the currently selected elements</returns>
            [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]
            /* IRawElementProviderSimple */ object[] GetSelection();
 
            /// <summary>
            /// Indicates whether the control allows more than one element to be selected
            /// </summary>
            /// <returns>Boolean indicating whether the control allows more than one element to be selected</returns>
            /// <remarks>If this is false, then the control is a single-select ccntrol</remarks>
            bool CanSelectMultiple {
                [return: MarshalAs(UnmanagedType.Bool)]
                get;
            }
 
            /// <summary>
            /// Indicates whether the control requires at least one element to be selected
            /// </summary>
            /// <returns>Boolean indicating whether the control requires at least one element to be selected</returns>
            /// <remarks>If this is false, then the control allows all elements to be unselected</remarks>
            bool IsSelectionRequired {
                [return: MarshalAs(UnmanagedType.Bool)]
                get;
            }
        }
 
        /// <summary>
        /// Define a Selectable Item (only supported on logical elements that are a 
        /// child of an Element that supports SelectionPattern and is itself selectable).  
        /// This allows for manipulation of Selection from the element itself.
        /// </summary>
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [ComVisible(true)]
        [Guid("2acad808-b2d4-452d-a407-91ff1ad167b2")]
        public interface ISelectionItemProvider
        {
            /// <summary>
            /// Sets the current element as the selection
            /// This clears the selection from other elements in the container.
            /// </summary>
            void Select();
 
            /// <summary>
            /// Adds current element to selection.
            /// </summary>
            void AddToSelection();
 
            /// <summary>
            /// Removes current element from selection.
            /// </summary>
            void RemoveFromSelection();
 
            /// <summary>
            /// Check whether an element is selected.
            /// </summary>
            /// <returns>Returns true if the element is selected.</returns>
            bool IsSelected { [return: MarshalAs(UnmanagedType.Bool)] get; }
 
            /// <summary>
            /// The logical element that supports the SelectionPattern for this Item.
            /// </summary>
            /// <returns>Returns a IRawElementProviderSimple.</returns>
            IRawElementProviderSimple SelectionContainer { [return: MarshalAs(UnmanagedType.Interface)] get; }
        }
 
        /// <summary>
        /// Implemented by providers which want to provide information about or want to
        /// reposition contained HWND-based elements.
        /// </summary>
        [ComVisible(true)]
        [Guid("1d5df27c-8947-4425-b8d9-79787bb460b8")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IRawElementProviderHwndOverride : IRawElementProviderSimple {
            /// <summary>
            /// Request a provider for the specified component. The returned provider can supply additional
            /// properties or override properties of the specified component.
            /// </summary>
            /// <param name="hwnd">The window handle of the component.</param>
            /// <returns>Return the provider for the specified component, or null if the component is not being overridden.</returns>
            [return: MarshalAs(UnmanagedType.Interface)]
            IRawElementProviderSimple GetOverrideProviderForHwnd(IntPtr hwnd);
        }
 
        /// <SecurityNote>
        ///     Critical:Elevates to Unmanaged code permission
        /// </SecurityNote>
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [Guid("6D5140C1-7436-11CE-8034-00AA006009FA")]
        [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        internal interface IServiceProvider {
            ///<SecurityNote>
            /// Critical elevates via a SUC.
            ///</SecurityNote>
            [SuppressUnmanagedCodeSecurity, SecurityCritical]
            [PreserveSig]
            int QueryService(ref Guid service, ref Guid riid, out IntPtr ppvObj);
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComVisible(true)]
        [ComImport()]
        [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliantAttribute(false)]
        [Guid("F8B80ADA-2C44-48D0-89BE-5FF23C9CD875")]
        internal interface IAccessibleEx {
            // Returns the IAccessibleEx for specified child. Returns
            // S_OK/NULL if this implementation does not use child ids,
            // or does not have an IAccessibleEx for the specified child,
            // or already represents a child element.
            // idChild must be normalized; ie. client must have previously
            // used get_accChild to check whether it actually has its own
            // IAccessible. Only idChild values that do not have a corresponding
            // IAccessible can be used here.
 
            [return: MarshalAs(UnmanagedType.IUnknown)]
            object GetObjectForChild(int idChild);
 
            // Returns an IAccessible and idChild pair for this IAccessibleEx.
            // Implementation must return fully normalized idChild values: ie.
            // it is not required to call get_accChild on the resulting pair.
            //
            // For IAccessible implementations that do not use child ids, this
            // just returns the corresponding IAccessible and CHILDID_SELF.
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int GetIAccessiblePair(
            [Out, MarshalAs(UnmanagedType.Interface)]
            out object /*UnsafeNativeMethods.IAccessible*/ ppAcc,
            [Out] out int pidChild);
 
            [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)]
            int[] GetRuntimeId();
 
            // Some wrapper-based implementations (notably UIABridge) can't reasonably wrap all
            // IRawElementProviderSimple elements returned as property values or patterns, so
            // these elements won't QI to IAccessibleEx. Where this is the case, the original
            // IAccessibleEx that the property was retreived from must implement this method
            // so that the client can get an IAccessibleEx.
            //
            // Usage for a client is as follows:
            // When an IRawElementProviderSimple is obtained as a property value,
            // - first try to QI to IAccessibleEx
            // - if that fails, call this method on the source IAccessibleEx
            [return: MarshalAs(UnmanagedType.I4)]
            [PreserveSig]
            int ConvertReturnedElement(
            [In, MarshalAs(UnmanagedType.Interface)]
            object /*UnsafeNativeMethods.IRawElementProviderSimple*/ pIn,
            [Out, MarshalAs(UnmanagedType.Interface)]
            out object /*UnsafeNativeMethods.IAccessibleEx*/ ppRetValOut);
        }
 
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComVisible(true)]
        [ComImport()]
        [Guid("d847d3a5-cab0-4a98-8c32-ecb45c59ad24")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IExpandCollapseProvider {
            /// <summary>
            /// Blocking method that returns after the element has been expanded.
            /// </summary>
            void Expand();
 
            /// <summary>
            /// Blocking method that returns after the element has been collapsed.
            /// </summary>
            void Collapse();
 
            ///<summary>indicates an element's current Collapsed or Expanded state</summary>
            ExpandCollapseState ExpandCollapseState {
                get;
            }
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComVisible(true)]
        [ComImport()]
        [Guid("c7935180-6fb3-4201-b174-7df73adbf64a")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IValueProvider {
            /// <summary>
            /// Request to set the value that this UI element is representing
            /// </summary>
            /// <param name="value">Value to set the UI to</param>
            void SetValue([MarshalAs(UnmanagedType.LPWStr)] string value);
 
            ///<summary>Value of a value control, as a a string.</summary>
            string Value {
                get;
            }
 
            ///<summary>Indicates that the value can only be read, not modified.
            ///returns True if the control is read-only</summary>
            bool IsReadOnly {
                [return: MarshalAs(UnmanagedType.Bool)] // CLR bug? Without this, only lower SHORT of BOOL*pRetVal param is updated.
                get;
            }
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [Guid("36dc7aef-33e6-4691-afe1-2be7274b3d33")]
        public interface IRangeValueProvider {
            void SetValue(double value);
 
            double Value { get; }
 
            bool IsReadOnly { [return: MarshalAs(UnmanagedType.Bool)] get; }
 
            double Maximum { get; }
 
            double Minimum { get; }
 
            double LargeChange { get; }
 
            double SmallChange { get; }
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("D6DD68D1-86FD-4332-8666-9ABEDEA2D24C")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliantAttribute(false)]
        public interface IRawElementProviderSimple {
            /// <summary>
            /// Indicates the type of provider this is, for example, whether it is a client-side
            /// or server-side provider.
            /// </summary>
            /// <remarks>
            /// Providers must specify at least either one of ProviderOptions.ClientSideProvider
            /// or ProviderOptions.ServerSideProvider.
            /// 
            /// UIAutomation treats different types of providers
            /// differently - for example, events from server-side provider are broadcast to all listening
            /// clients, whereas events from client-side providers remain in that client.
            /// </remarks>
            ProviderOptions ProviderOptions {
                get;
            }
 
            /// <summary>
            /// Get a pattern interface from this object
            /// </summary>
            /// <param name="patternId">Identifier indicating the interface to return</param>
            /// <returns>Returns the interface as an object, if supported; otherwise returns null/</returns>
            [return: MarshalAs(UnmanagedType.IUnknown)]
            object GetPatternProvider(int patternId);
 
            /// <summary>
            /// Request value of specified property from an element.
            /// </summary>
            /// <param name="propertyId">Identifier indicating the property to return</param>
            /// <returns>Returns a ValInfo indicating whether the element supports this property, or has no value for it.</returns>
            object GetPropertyValue(int propertyId);
 
            // Only native impl roots need to return something for this,
            // proxies always return null (cause we already know their HWNDs)
            // If proxies create themselves when handling winvents events, then they
            // also need to implement this so we can determine the HWND. Still only
            // lives on a root, however.
            /// <summary>
            /// Returns a base provider for this element.
            ///
            /// Typically only used by elements that correspond directly to a Win32 Window Handle,
            /// in which case the implementation returns AutomationInteropProvider.BaseElementFromHandle( hwnd ).
            /// </summary>
            IRawElementProviderSimple HostRawElementProvider {
                get;
            }
        }
 
        /// <summary>
        /// Directions for navigation the UIAutomation tree
        /// </summary>
        [ComVisible(true)]
        [Guid("670c3006-bf4c-428b-8534-e1848f645122")]
        public enum NavigateDirection {
            /// <summary>Navigate to parent</summary>
            Parent,
            /// <summary>Navigate to next sibling</summary>
            NextSibling,
            /// <summary>Navigate to previous sibling</summary>
            PreviousSibling,
            /// <summary>Navigate to first child</summary>
            FirstChild,
            /// <summary>Navigate to last child</summary>
            LastChild,
        }
 
        /// <summary>
        /// Implemented by providers to expose elements that are part of
        /// a structure more than one level deep. For simple one-level
        /// structures which have no children, IRawElementProviderSimple
        /// can be used instead.
        /// 
        /// The root node of the fragment must support the IRawElementProviderFragmentRoot
        /// interface, which is derived from this, and has some additional methods.
        /// </summary>
        [ComVisible(true)]
        [Guid("f7063da8-8359-439c-9297-bbc5299a7d87")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [CLSCompliant(false)]
        public interface IRawElementProviderFragment : IRawElementProviderSimple {
            /// <summary>
            /// Request to return the element in the specified direction
            /// </summary>
            /// <param name="direction">Indicates the direction in which to navigate</param>
            /// <returns>Returns the element in the specified direction</returns>
            [return: MarshalAs(UnmanagedType.IUnknown)]
            object /*IRawElementProviderFragment*/ Navigate(NavigateDirection direction);
 
 
            /// <summary>
            /// Gets the runtime ID of an elemenent. This should be unique
            /// among elements on a desktop.
            /// </summary>
            /// <remarks>
            /// Proxy implementations should return null for the top-level proxy which
            /// correpsonds to the HWND; and should return an array which starts
            /// with AutomationInteropProvider.AppendRuntimeId, followed by values
            /// which are then unique within that proxy's HWNDs.
            /// </remarks>
            int[] GetRuntimeId();
 
            /// <summary>
            /// Return a bounding rectangle of this element
            /// </summary>
            NativeMethods.UiaRect BoundingRectangle {
                get;
            }
 
            /// <summary>
            /// If this UI is capable of hosting other UI that also supports UIAutomation, and
            /// the subtree rooted at this element contains such hosted UI fragments, this should return
            /// an array of those fragments.
            /// 
            /// If this UI does not host other UI, it may return null.
            /// </summary>
            [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]
            object[] /*IRawElementProviderSimple[]*/ GetEmbeddedFragmentRoots();
 
            /// <summary>
            /// Request that focus is set to this item.
            /// The UIAutomation framework will ensure that the UI hosting this fragment is already
            /// focused before calling this method, so this method should only update its internal
            /// focus state; it should not attempt to give its own HWND the focus, for example.
            /// </summary>
            void SetFocus();
 
            /// <summary>
            /// Return the element that is the root node of this fragment of UI.
            /// </summary>
            IRawElementProviderFragmentRoot FragmentRoot {
                [return: MarshalAs(UnmanagedType.Interface)]
                get;
            }
        }
 
        /// <summary>
        /// The root element in a fragment of UI must support this interface. Other
        /// elements in the same fragment need to support the IRawElementProviderFragment
        /// interface.
        /// </summary>
        [ComVisible(true)]
        [Guid("620ce2a5-ab8f-40a9-86cb-de3c75599b58")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [CLSCompliant(false)]
        public interface IRawElementProviderFragmentRoot : IRawElementProviderFragment {
            /// <summary>
            /// Return the child element at the specified point, if one exists,
            /// otherwise return this element if the point is on this element,
            /// otherwise return null.
            /// </summary>
            /// <param name="x">x coordinate of point to check</param>
            /// <param name="y">y coordinate of point to check</param>
            /// <returns>Return the child element at the specified point, if one exists,
            /// otherwise return this element if the point is on this element,
            /// otherwise return null.
            /// </returns>
            [return: MarshalAs(UnmanagedType.IUnknown)]
            object /*IRawElementProviderFragment*/ ElementProviderFromPoint(double x, double y);
 
            /// <summary>
            /// Return the element in this fragment which has the keyboard focus,
            /// </summary>
            /// <returns>Return the element in this fragment which has the keyboard focus,
            /// if any; otherwise return null.</returns>
            [return: MarshalAs(UnmanagedType.IUnknown)]
            object /*IRawElementProviderFragment*/ GetFocus();
        }
 
        [Flags]
        public enum ToggleState {
            ToggleState_Off = 0,
            ToggleState_On = 1,
            ToggleState_Indeterminate = 2
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("56D00BD0-C4F4-433C-A836-1A52A57E0892")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliantAttribute(false)]
        public interface IToggleProvider {
            void Toggle();
 
            ///<summary>indicates an element's current on or off state</summary>
            ToggleState ToggleState {
                get;
            }
        }
 
        [Flags] 
        public enum RowOrColumnMajor {
            RowOrColumnMajor_RowMajor = 0,
            RowOrColumnMajor_ColumnMajor = 1,
            RowOrColumnMajor_Indeterminate = 2
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("9c860395-97b3-490a-b52a-858cc22af166")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliant(false)]
        public interface ITableProvider {
            [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]
            object[] /*IRawElementProviderSimple[]*/ GetRowHeaders();
 
            [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]
            object[] /*IRawElementProviderSimple[]*/ GetColumnHeaders();
 
            RowOrColumnMajor RowOrColumnMajor {
                get;
            }
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("b9734fa6-771f-4d78-9c90-2517999349cd")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliant(false)]
        public interface ITableItemProvider {
            [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]
            object[] /*IRawElementProviderSimple[]*/ GetRowHeaderItems();
 
            [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)]
            object[] /*IRawElementProviderSimple[]*/ GetColumnHeaderItems();
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("b17d6187-0907-464b-a168-0ef17a1572b1")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliant(false)] 
        public interface IGridProvider {
            [return: MarshalAs(UnmanagedType.IUnknown)]
            object /*IRawElementProviderSimple*/ GetItem(int row, int column);
 
            int RowCount {
                [return: MarshalAs(UnmanagedType.I4)]
                get;
            }
 
            int ColumnCount {
                [return: MarshalAs(UnmanagedType.I4)]
                get;
            }
        }
 
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("d02541f1-fb81-4d64-ae32-f520f8a6dbd1")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliant(false)] 
        public interface IGridItemProvider {
            int Row {
                [return: MarshalAs(UnmanagedType.I4)]
                get;
            }
 
            int Column {
                [return: MarshalAs(UnmanagedType.I4)]
                get;
            }
 
            int RowSpan {
                [return: MarshalAs(UnmanagedType.I4)]
                get;
            }
 
            int ColumnSpan {
                [return: MarshalAs(UnmanagedType.I4)]
                get;
            }
 
            IRawElementProviderSimple ContainingGrid {
                [return: MarshalAs(UnmanagedType.Interface)]
                get;
            }
        }
 
        /// <summary>
        /// Implemented by objects that have a single, unambiguous, action associated with them.
        /// These objects are usually stateless, and invoking them does not change their own state,
        /// but causes something to happen in the larger context of the app the control is in.
        /// 
        /// Examples of UI that implments this includes:
        /// Push buttons
        /// Hyperlinks
        /// Menu items
        /// </summary>
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("54fcb24b-e18e-47a2-b4d3-eccbe77599a2")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliant(false)]
        public interface IInvokeProvider {
            /// <summary>
            /// Request that the control initiate its action.
            /// Should return immediately without blocking.
            /// There is no way to determine what happened, when it happend, or whether
            /// anything happened at all.
            /// </summary>
            void Invoke();
        }
 
        /// <summary>
        /// Implemented by objects in a known Scrollable context, such as ListItems, ListViewItems, TreeViewItems, and Tabs.
        /// This allows them to be scrolled into view using known API's based on the control in question.
        /// </summary>
        [SecurityCritical(SecurityCriticalScope.Everything)]
        [ComImport()]
        [ComVisible(true)]
        [Guid("2360c714-4bf1-4b26-ba65-9b21316127eb")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [CLSCompliant(false)]
        public interface IScrollItemProvider {
            /// <summary>
            /// Scrolls the windows containing this automation element to make this element visible.
            /// InvalidOperationException should be thrown if item becomes unable to be scrolled. Makes
            /// no guarantees about where the item will be in the scrolled window.
            /// </summary>
            void ScrollIntoView();
        }
 
        public static IntPtr LoadLibraryFromSystemPathIfAvailable(string libraryName) {
            IntPtr module = IntPtr.Zero;
 
            // KB2533623 introduced the LOAD_LIBRARY_SEARCH_SYSTEM32 flag. It also introduced
            // the AddDllDirectory function. We test for presence of AddDllDirectory as an 
            // indirect evidence for the support of LOAD_LIBRARY_SEARCH_SYSTEM32 flag. 
            IntPtr kernel32 = GetModuleHandle(ExternDll.Kernel32);
            if (kernel32 != IntPtr.Zero) {
                if (GetProcAddress(new HandleRef(null, kernel32), "AddDllDirectory") != IntPtr.Zero) {
                    module = LoadLibraryEx(libraryName, IntPtr.Zero, NativeMethods.LOAD_LIBRARY_SEARCH_SYSTEM32);
                } else {
                    // LOAD_LIBRARY_SEARCH_SYSTEM32 is not supported on this OS. 
                    // Fall back to using plain ol' LoadLibrary
                    // There is risk that this call might fail, or that it might be
                    // susceptible to DLL hijacking. 
                    module = LoadLibrary(libraryName);
                }
            }
            return module;
        }
 
        /// <summary>
        /// Retrieves a value that describes the Device Guard policy enforcement status for .NET dynamic code.
        /// introduced in RS4 (Win10 1803)
        /// </summary>
        /// <param name="enabled">On success, returns true if the Device Guard policy enforces .NET Dynamic Code policy; otherwise, returns false.</param>
        /// <returns>This method returns S_OK if successful or a failure code otherwise.</returns>
        [DllImport(ExternDll.Wldp, ExactSpelling = true)]
        [ResourceExposure(ResourceScope.None)]
        private static extern int WldpIsDynamicCodePolicyEnabled([Out] out int enabled);
 
        internal static bool IsDynamicCodePolicyEnabled() {
            if (!ApiHelper.IsApiAvailable(ExternDll.Wldp, "WldpIsDynamicCodePolicyEnabled")) {
                return false;
            }
            // Default to a compatible case
            int isEnabled = 0;
            int result = UnsafeNativeMethods.WldpIsDynamicCodePolicyEnabled(out isEnabled);
            return ((result == NativeMethods.S_OK) && (isEnabled != 0));
        }
 
    }
}