hi, guys,
I just try to create webbrowser using the very original form to avoid the well-known memory leak of c# webbrower control. But I cant make my code working. First, I initialed OLE, and then create webbrowser, just the same
steps like http://msdn.microsoft.com/en-us/library/aa770041(v=VS.85).aspx http://msdn.microsoft.com/en-us/library/aa770041(v=VS.85).aspx tells us. But when I try to navigator google.com, error occured, which is:
HRESULT:0x80004005 <br/>
(unknown error).
Could anyone be kind to help me ?
here is my main code:
// initial ole<br/>
OleInitialize(IntPtr.Zero);
//Create a new WB, throws exception if fails<br/>
Type webbrowsertype = Type.GetTypeFromCLSID(new Guid("8856F961-340A-11D0-A96B-00C04FD705A2"), true);<br/>
//Using Activator inplace of CoCreateInstance, returns IUnknown<br/>
object gwb = System.Activator.CreateInstance(webbrowsertype);
// set client site<br/>
IOleObject ioo = (IOleObject)gwb;<br/>
ioo.SetClientSite(this);
ioo.SetHostNames("GWebBrowser", string.Empty);
//Get the IOleInPlaceObject<br/>
IOleInPlaceObject ioip = (IOleInPlaceObject)gwb;<br/>
tagRECT trect1 = new tagRECT(0, 0, 300, 300);<br/>
tagRECT trect2 = new tagRECT(0, 0, 300, 300);<br/>
//Set WB rects<br/>
ioip.SetObjectRects(ref trect1, ref trect2);
tagRECT rect = new tagRECT(0, 0, 300, 300);<br/>
tagMSG nullmsg = new tagMSG();<br/>
ioo.DoVerb(-1, ref nullmsg, this, 0, this.Handle, ref rect);
IWebBrowser2 wb = (IWebBrowser2)gwb;<br/>
object nullObj = null;<br/>
<br/>
// this line will be ERROR! HRESULT:0x80004005
<br/>
wb.Navigate(" http://www.google.com www.google.com ", ref nullObj, ref nullObj, ref nullObj, ref nullObj);
I implement IOleClientSite like this:
int IOleClientSite.SaveObject()<br/>
{<br/>
return unchecked((int)0x80004001);<br/>
//throw new Exception("The method or operation is not implemented.");<br/>
}
int IOleClientSite.GetMoniker(uint dwAssign, uint dwWhichMoniker, out IMoniker ppmk)<br/>
{<br/>
ppmk = null;<br/>
return unchecked((int)0x80004001);<br/>
}
int IOleClientSite.GetContainer(out IOleContainer ppContainer)<br/>
{<br/>
ppContainer = null;<br/>
return unchecked((int)0x80004001);<br/>
}
int IOleClientSite.ShowObject()<br/>
{<br/>
return 0;<br/>
}
int IOleClientSite.OnShowWindow(bool fShow)<br/>
{<br/>
return unchecked((int)0x80004001);<br/>
}
int IOleClientSite.RequestNewObjectLayout()<br/>
{<br/>
return unchecked((int)0x80004001);<br/>
}
And, here is the interface define:
namespace WindowsFormsApplication1<br/>
{<br/>
[ComImport,<br/>
Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E"),<br/>
InterfaceType(ComInterfaceType.InterfaceIsIDispatch),<br/>
SuppressUnmanagedCodeSecurity]<br/>
public interface IWebBrowser2<br/>
{<br/>
[DispId(100)]<br/>
void GoBack();<br/>
[DispId(0x65)]<br/>
void GoForward();<br/>
[DispId(0x66)]<br/>
void GoHome();<br/>
[DispId(0x67)]<br/>
void GoSearch();<br/>
[DispId(0x68)]<br/>
void Navigate([MarshalAs(UnmanagedType.BStr)] string URL, [In] ref object Flags, [In] ref object TargetFrameName, [In] ref object PostData, [In] ref object Headers);<br/>
[DispId(-550)]<br/>
void Refresh();<br/>
[DispId(0x69)]<br/>
void Refresh2([In] ref object Level);<br/>
[DispId(0x6a)]<br/>
void Stop();<br/>
[DispId(300)]<br/>
void Quit();<br/>
[DispId(0x12d)]<br/>
void ClientToWindow([In, Out] ref int pcx, [In, Out] ref int pcy);<br/>
[DispId(0x12e)]<br/>
void PutProperty([MarshalAs(UnmanagedType.BStr)] string Property, object vtValue);<br/>
[DispId(0x12f)]<br/>
object GetProperty([MarshalAs(UnmanagedType.BStr)] string Property);<br/>
[DispId(500)]<br/>
void Navigate2([In] ref object URL, [In] ref object Flags, [In] ref object TargetFrameName, [In] ref object PostData, [In] ref object Headers);<br/>
[DispId(0x1f5)]<br/>
OLECMDF QueryStatusWB(OLECMDID cmdID);<br/>
[DispId(0x1f6)]<br/>
void ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, [In] ref object pvaIn, [In, Out] ref object pvaOut);<br/>
[DispId(0x1f7)]<br/>
void ShowBrowserBar([In] ref object pvaClsid, [In] ref object pvarShow, [In] ref object pvarSize);<br/>
bool AddressBar { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x22b)] get; [DispId(0x22b)] set; }<br/>
object Application { [return: MarshalAs(UnmanagedType.IDispatch)] [DispId(200)] get; }<br/>
bool Busy { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0xd4)] get; }<br/>
object Container { [return: MarshalAs(UnmanagedType.IDispatch)] [DispId(0xca)] get; }<br/>
object Document { [return: MarshalAs(UnmanagedType.IDispatch)] [DispId(0xcb)] get; }<br/>
string FullName { [return: MarshalAs(UnmanagedType.BStr)] [DispId(400)] get; }<br/>
bool FullScreen { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x197)] get; [DispId(0x197)] set; }<br/>
int Height { [DispId(0xd1)] get; [DispId(0xd1)] set; }<br/>
int HWND { [DispId(-515)] get; }<br/>
int Left { [DispId(0xce)] get; [DispId(0xce)] set; }<br/>
string LocationName { [return: MarshalAs(UnmanagedType.BStr)] [DispId(210)] get; }<br/>
string LocationURL { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0xd3)] get; }<br/>
bool MenuBar { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x196)] get; [DispId(0x196)] set; }<br/>
string Name { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0)] get; }<br/>
bool Offline { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(550)] get; [DispId(550)] set; }<br/>
object Parent { [return: MarshalAs(UnmanagedType.IDispatch)] [DispId(0xc9)] get; }<br/>
string Path { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x191)] get; }<br/>
tagREADYSTATE ReadyState { [DispId(-525)] get; }<br/>
bool RegisterAsBrowser { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x228)] get; [DispId(0x228)] set; }<br/>
bool RegisterAsDropTarget { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x229)] get; [DispId(0x229)] set; }<br/>
bool Resizable { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x22c)] get; [DispId(0x22c)] set; }<br/>
bool Silent { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x227)] get; [DispId(0x227)] set; }<br/>
bool StatusBar { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x193)] get; [DispId(0x193)] set; }<br/>
string StatusText { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x194)] get; [DispId(0x194)] set; }<br/>
bool TheaterMode { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x22a)] get; [DispId(0x22a)] set; }<br/>
int ToolBar { [DispId(0x195)] get; [DispId(0x195)] set; }<br/>
int Top { [DispId(0xcf)] get; [DispId(0xcf)] set; }<br/>
bool TopLevelContainer { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0xcc)] get; }<br/>
string Type { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0xcd)] get; }<br/>
bool Visible { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x192)] get; [DispId(0x192)] set; }<br/>
int Width { [DispId(0xd0)] get; [DispId(0xd0)] set; }<br/>
}
[ComImport, ComVisible(true)]<br/>
[Guid("00000112-0000-0000-C000-000000000046")]<br/>
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br/>
public interface IOleObject<br/>
{<br/>
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetClientSite(<br/>
[In, MarshalAs(UnmanagedType.Interface)] IOleClientSite pClientSite);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetClientSite(<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out IOleClientSite site);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetHostNames(<br/>
[In, MarshalAs(UnmanagedType.LPWStr)] string szContainerApp,<br/>
[In, MarshalAs(UnmanagedType.LPWStr)] string szContainerObj);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int Close([In, MarshalAs(UnmanagedType.U4)] uint dwSaveOption);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetMoniker(<br/>
[In, MarshalAs(UnmanagedType.U4)] int dwWhichMoniker,<br/>
[In, MarshalAs(UnmanagedType.Interface)] IMoniker pmk);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetMoniker(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwAssign,<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwWhichMoniker,<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out IMoniker moniker);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int InitFromData(<br/>
[In, MarshalAs(UnmanagedType.Interface)] System.Runtime.InteropServices.ComTypes.IDataObject pDataObject,<br/>
[In, MarshalAs(UnmanagedType.Bool)] bool fCreation,<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwReserved);
int GetClipboardData(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwReserved,<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out System.Runtime.InteropServices.ComTypes.IDataObject data);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int DoVerb(<br/>
[In, MarshalAs(UnmanagedType.I4)] int iVerb,<br/>
[In, MarshalAs(UnmanagedType.Struct)] ref tagMSG lpmsg,<br/>
//[In] IntPtr lpmsg,<br/>
[In, MarshalAs(UnmanagedType.Interface)] IOleClientSite pActiveSite,<br/>
//[In] IntPtr pActiveSite,<br/>
[In, MarshalAs(UnmanagedType.I4)] int lindex,<br/>
[In] IntPtr hwndParent,<br/>
[In, MarshalAs(UnmanagedType.Struct)] ref tagRECT lprcPosRect);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int EnumVerbs([Out, MarshalAs(UnmanagedType.Interface)] out Object e);<br/>
//int EnumVerbs(out IEnumOLEVERB e);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int OleUpdate();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int IsUpToDate();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetUserClassID([In, Out] ref Guid pClsid);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetUserType(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwFormOfType,<br/>
[Out, MarshalAs(UnmanagedType.LPWStr)] out string userType);
//[return: MarshalAs(UnmanagedType.I4)]<br/>
//[PreserveSig]<br/>
//int SetExtent(<br/>
// [In, MarshalAs(UnmanagedType.U4)] uint dwDrawAspect,<br/>
// [In, MarshalAs(UnmanagedType.Struct)] ref tagSIZEL pSizel);
//[return: MarshalAs(UnmanagedType.I4)]<br/>
//[PreserveSig]<br/>
//int GetExtent(<br/>
// [In, MarshalAs(UnmanagedType.U4)] uint dwDrawAspect,<br/>
// [In, Out, MarshalAs(UnmanagedType.Struct)] ref tagSIZEL pSizel);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int Advise(<br/>
[In, MarshalAs(UnmanagedType.Interface)] IAdviseSink pAdvSink,<br/>
out int cookie);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int Unadvise(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwConnection);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int EnumAdvise(out IEnumSTATDATA e);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetMiscStatus(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwAspect,<br/>
out int misc);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetColorScheme([In, MarshalAs(UnmanagedType.Struct)] ref object pLogpal);<br/>
}
[ComVisible(true), StructLayout(LayoutKind.Sequential)]<br/>
public struct tagMSG<br/>
{<br/>
public IntPtr hwnd;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int message;<br/>
public IntPtr wParam;<br/>
public IntPtr lParam;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int time;<br/>
// pt was a by-value POINT structure<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int pt_x;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int pt_y;<br/>
//public tagPOINT pt;<br/>
}
[ComVisible(true), StructLayout(LayoutKind.Sequential)]<br/>
public struct tagRECT<br/>
{<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int Left;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int Top;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int Right;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int Bottom;
public tagRECT(int left_, int top_, int right_, int bottom_)<br/>
{<br/>
Left = left_;<br/>
Top = top_;<br/>
Right = right_;<br/>
Bottom = bottom_;<br/>
}<br/>
}
[ComImport, ComVisible(true)]<br/>
[Guid("00000118-0000-0000-C000-000000000046")]<br/>
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br/>
public interface IOleClientSite<br/>
{<br/>
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SaveObject();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetMoniker(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwAssign,<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwWhichMoniker,<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out IMoniker ppmk);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetContainer(<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out IOleContainer ppContainer);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int ShowObject();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int OnShowWindow([In, MarshalAs(UnmanagedType.Bool)] bool fShow);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int RequestNewObjectLayout();<br/>
}
[ComImport(), ComVisible(true),<br/>
Guid("0000011B-0000-0000-C000-000000000046"),<br/>
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]<br/>
public interface IOleContainer<br/>
{<br/>
//IParseDisplayName<br/>
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int ParseDisplayName(<br/>
[In, MarshalAs(UnmanagedType.Interface)] object pbc,<br/>
[In, MarshalAs(UnmanagedType.BStr)] string pszDisplayName,<br/>
[Out, MarshalAs(UnmanagedType.LPArray)] int[] pchEaten,<br/>
[Out, MarshalAs(UnmanagedType.LPArray)] object[] ppmkOut);
//IOleContainer<br/>
//[return: MarshalAs(UnmanagedType.I4)]<br/>
//[PreserveSig]<br/>
//int EnumObjects(<br/>
// [In, MarshalAs(UnmanagedType.U4)] tagOLECONTF grfFlags,<br/>
// out IEnumUnknown ppenum);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int LockContainer(<br/>
[In, MarshalAs(UnmanagedType.Bool)] Boolean fLock);<br/>
}
public enum tagOLECONTF<br/>
{<br/>
OLECONTF_EMBEDDINGS = 1,<br/>
OLECONTF_LINKS = 2,<br/>
OLECONTF_OTHERS = 4,<br/>
OLECONTF_ONLYUSER = 8,<br/>
OLECONTF_ONLYIFRUNNING = 16<br/>
}<br/>
[ComVisible(true), ComImport(),<br/>
Guid("00000113-0000-0000-C000-000000000046"),<br/>
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]<br/>
public interface IOleInPlaceObject<br/>
{<br/>
//IOleWindow<br/>
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetWindow([In, Out] ref IntPtr phwnd);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int ContextSensitiveHelp([In, MarshalAs(UnmanagedType.Bool)] bool<br/>
fEnterMode);
//IOleInPlaceObject<br/>
void InPlaceDeactivate();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int UIDeactivate();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetObjectRects(<br/>
[In, MarshalAs(UnmanagedType.Struct)] ref tagRECT lprcPosRect,<br/>
[In, MarshalAs(UnmanagedType.Struct)] ref tagRECT lprcClipRect);
void ReactivateAndUndo();<br/>
}
public enum tagREADYSTATE<br/>
{<br/>
READYSTATE_UNINITIALIZED = 0,<br/>
READYSTATE_LOADING = 1,<br/>
READYSTATE_LOADED = 2,<br/>
READYSTATE_INTERACTIVE = 3,<br/>
READYSTATE_COMPLETE = 4<br/>
}<br/>
public enum OLECMDF<br/>
{<br/>
OLECMDF_SUPPORTED = 1,<br/>
OLECMDF_ENABLED = 2,<br/>
OLECMDF_LATCHED = 4,<br/>
OLECMDF_NINCHED = 8,<br/>
OLECMDF_INVISIBLE = 16,<br/>
OLECMDF_DEFHIDEONCTXTMENU = 32<br/>
}<br/>
public enum OLECMDID<br/>
{<br/>
OLECMDID_OPEN = 1,<br/>
OLECMDID_NEW = 2,<br/>
OLECMDID_SAVE = 3,<br/>
OLECMDID_SAVEAS = 4,<br/>
OLECMDID_SAVECOPYAS = 5,<br/>
OLECMDID_PRINT = 6,<br/>
OLECMDID_PRINTPREVIEW = 7,<br/>
OLECMDID_PAGESETUP = 8,<br/>
OLECMDID_SPELL = 9,<br/>
OLECMDID_PROPERTIES = 10,<br/>
OLECMDID_CUT = 11,<br/>
OLECMDID_COPY = 12,<br/>
OLECMDID_PASTE = 13,<br/>
OLECMDID_PASTESPECIAL = 14,<br/>
OLECMDID_UNDO = 15,<br/>
OLECMDID_REDO = 16,<br/>
OLECMDID_SELECTALL = 17,<br/>
OLECMDID_CLEARSELECTION = 18,<br/>
OLECMDID_ZOOM = 19,<br/>
OLECMDID_GETZOOMRANGE = 20,<br/>
OLECMDID_UPDATECOMMANDS = 21,<br/>
OLECMDID_REFRESH = 22,<br/>
OLECMDID_STOP = 23,<br/>
OLECMDID_HIDETOOLBARS = 24,<br/>
OLECMDID_SETPROGRESSMAX = 25,<br/>
OLECMDID_SETPROGRESSPOS = 26,<br/>
OLECMDID_SETPROGRESSTEXT = 27,<br/>
OLECMDID_SETTITLE = 28,<br/>
OLECMDID_SETDOWNLOADSTATE = 29,<br/>
OLECMDID_STOPDOWNLOAD = 30,<br/>
OLECMDID_ONTOOLBARACTIVATED = 31,<br/>
OLECMDID_FIND = 32,<br/>
OLECMDID_DELETE = 33,<br/>
OLECMDID_HTTPEQUIV = 34,<br/>
OLECMDID_HTTPEQUIV_DONE = 35,<br/>
OLECMDID_ENABLE_INTERACTION = 36,<br/>
OLECMDID_ONUNLOAD = 37,<br/>
OLECMDID_PROPERTYBAG2 = 38,<br/>
OLECMDID_PREREFRESH = 39,<br/>
OLECMDID_SHOWSCRIPTERROR = 40,<br/>
OLECMDID_SHOWMESSAGE = 41,<br/>
OLECMDID_SHOWFIND = 42,<br/>
OLECMDID_SHOWPAGESETUP = 43,<br/>
OLECMDID_SHOWPRINT = 44,<br/>
OLECMDID_CLOSE = 45,<br/>
OLECMDID_ALLOWUILESSSAVEAS = 46,<br/>
OLECMDID_DONTDOWNLOADCSS = 47,<br/>
OLECMDID_UPDATEPAGESTATUS = 48,<br/>
OLECMDID_PRINT2 = 49,<br/>
OLECMDID_PRINTPREVIEW2 = 50,<br/>
OLECMDID_SETPRINTTEMPLATE = 51,<br/>
OLECMDID_GETPRINTTEMPLATE = 52,<br/>
OLECMDID_PAGEACTIONBLOCKED = 55,<br/>
OLECMDID_PAGEACTIONUIQUERY = 56,<br/>
OLECMDID_FOCUSVIEWCONTROLS = 57,<br/>
OLECMDID_FOCUSVIEWCONTROLSQUERY = 58,<br/>
OLECMDID_SHOWPAGEACTIONMENU = 59,<br/>
OLECMDID_ADDTRAVELENTRY = 60,<br/>
OLECMDID_UPDATETRAVELENTRY = 61,<br/>
OLECMDID_UPDATEBACKFORWARDSTATE = 62,<br/>
OLECMDID_OPTICAL_ZOOM = 63,<br/>
OLECMDID_OPTICAL_GETZOOMRANGE = 64,<br/>
OLECMDID_WINDOWSTATECHANGED = 65,<br/>
//OLECMDID_IE7_SHOWSCRIPTERROR = 69<br/>
}<br/>
public enum OLECMDEXECOPT<br/>
{<br/>
OLECMDEXECOPT_DODEFAULT = 0,<br/>
OLECMDEXECOPT_PROMPTUSER = 1,<br/>
OLECMDEXECOPT_DONTPROMPTUSER = 2,<br/>
OLECMDEXECOPT_SHOWHELP = 3<br/>
}<br/>
}
View the full article
I just try to create webbrowser using the very original form to avoid the well-known memory leak of c# webbrower control. But I cant make my code working. First, I initialed OLE, and then create webbrowser, just the same
steps like http://msdn.microsoft.com/en-us/library/aa770041(v=VS.85).aspx http://msdn.microsoft.com/en-us/library/aa770041(v=VS.85).aspx tells us. But when I try to navigator google.com, error occured, which is:
HRESULT:0x80004005 <br/>
(unknown error).
Could anyone be kind to help me ?
here is my main code:
// initial ole<br/>
OleInitialize(IntPtr.Zero);
//Create a new WB, throws exception if fails<br/>
Type webbrowsertype = Type.GetTypeFromCLSID(new Guid("8856F961-340A-11D0-A96B-00C04FD705A2"), true);<br/>
//Using Activator inplace of CoCreateInstance, returns IUnknown<br/>
object gwb = System.Activator.CreateInstance(webbrowsertype);
// set client site<br/>
IOleObject ioo = (IOleObject)gwb;<br/>
ioo.SetClientSite(this);
ioo.SetHostNames("GWebBrowser", string.Empty);
//Get the IOleInPlaceObject<br/>
IOleInPlaceObject ioip = (IOleInPlaceObject)gwb;<br/>
tagRECT trect1 = new tagRECT(0, 0, 300, 300);<br/>
tagRECT trect2 = new tagRECT(0, 0, 300, 300);<br/>
//Set WB rects<br/>
ioip.SetObjectRects(ref trect1, ref trect2);
tagRECT rect = new tagRECT(0, 0, 300, 300);<br/>
tagMSG nullmsg = new tagMSG();<br/>
ioo.DoVerb(-1, ref nullmsg, this, 0, this.Handle, ref rect);
IWebBrowser2 wb = (IWebBrowser2)gwb;<br/>
object nullObj = null;<br/>
<br/>
// this line will be ERROR! HRESULT:0x80004005
<br/>
wb.Navigate(" http://www.google.com www.google.com ", ref nullObj, ref nullObj, ref nullObj, ref nullObj);
I implement IOleClientSite like this:
int IOleClientSite.SaveObject()<br/>
{<br/>
return unchecked((int)0x80004001);<br/>
//throw new Exception("The method or operation is not implemented.");<br/>
}
int IOleClientSite.GetMoniker(uint dwAssign, uint dwWhichMoniker, out IMoniker ppmk)<br/>
{<br/>
ppmk = null;<br/>
return unchecked((int)0x80004001);<br/>
}
int IOleClientSite.GetContainer(out IOleContainer ppContainer)<br/>
{<br/>
ppContainer = null;<br/>
return unchecked((int)0x80004001);<br/>
}
int IOleClientSite.ShowObject()<br/>
{<br/>
return 0;<br/>
}
int IOleClientSite.OnShowWindow(bool fShow)<br/>
{<br/>
return unchecked((int)0x80004001);<br/>
}
int IOleClientSite.RequestNewObjectLayout()<br/>
{<br/>
return unchecked((int)0x80004001);<br/>
}
And, here is the interface define:
namespace WindowsFormsApplication1<br/>
{<br/>
[ComImport,<br/>
Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E"),<br/>
InterfaceType(ComInterfaceType.InterfaceIsIDispatch),<br/>
SuppressUnmanagedCodeSecurity]<br/>
public interface IWebBrowser2<br/>
{<br/>
[DispId(100)]<br/>
void GoBack();<br/>
[DispId(0x65)]<br/>
void GoForward();<br/>
[DispId(0x66)]<br/>
void GoHome();<br/>
[DispId(0x67)]<br/>
void GoSearch();<br/>
[DispId(0x68)]<br/>
void Navigate([MarshalAs(UnmanagedType.BStr)] string URL, [In] ref object Flags, [In] ref object TargetFrameName, [In] ref object PostData, [In] ref object Headers);<br/>
[DispId(-550)]<br/>
void Refresh();<br/>
[DispId(0x69)]<br/>
void Refresh2([In] ref object Level);<br/>
[DispId(0x6a)]<br/>
void Stop();<br/>
[DispId(300)]<br/>
void Quit();<br/>
[DispId(0x12d)]<br/>
void ClientToWindow([In, Out] ref int pcx, [In, Out] ref int pcy);<br/>
[DispId(0x12e)]<br/>
void PutProperty([MarshalAs(UnmanagedType.BStr)] string Property, object vtValue);<br/>
[DispId(0x12f)]<br/>
object GetProperty([MarshalAs(UnmanagedType.BStr)] string Property);<br/>
[DispId(500)]<br/>
void Navigate2([In] ref object URL, [In] ref object Flags, [In] ref object TargetFrameName, [In] ref object PostData, [In] ref object Headers);<br/>
[DispId(0x1f5)]<br/>
OLECMDF QueryStatusWB(OLECMDID cmdID);<br/>
[DispId(0x1f6)]<br/>
void ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, [In] ref object pvaIn, [In, Out] ref object pvaOut);<br/>
[DispId(0x1f7)]<br/>
void ShowBrowserBar([In] ref object pvaClsid, [In] ref object pvarShow, [In] ref object pvarSize);<br/>
bool AddressBar { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x22b)] get; [DispId(0x22b)] set; }<br/>
object Application { [return: MarshalAs(UnmanagedType.IDispatch)] [DispId(200)] get; }<br/>
bool Busy { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0xd4)] get; }<br/>
object Container { [return: MarshalAs(UnmanagedType.IDispatch)] [DispId(0xca)] get; }<br/>
object Document { [return: MarshalAs(UnmanagedType.IDispatch)] [DispId(0xcb)] get; }<br/>
string FullName { [return: MarshalAs(UnmanagedType.BStr)] [DispId(400)] get; }<br/>
bool FullScreen { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x197)] get; [DispId(0x197)] set; }<br/>
int Height { [DispId(0xd1)] get; [DispId(0xd1)] set; }<br/>
int HWND { [DispId(-515)] get; }<br/>
int Left { [DispId(0xce)] get; [DispId(0xce)] set; }<br/>
string LocationName { [return: MarshalAs(UnmanagedType.BStr)] [DispId(210)] get; }<br/>
string LocationURL { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0xd3)] get; }<br/>
bool MenuBar { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x196)] get; [DispId(0x196)] set; }<br/>
string Name { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0)] get; }<br/>
bool Offline { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(550)] get; [DispId(550)] set; }<br/>
object Parent { [return: MarshalAs(UnmanagedType.IDispatch)] [DispId(0xc9)] get; }<br/>
string Path { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x191)] get; }<br/>
tagREADYSTATE ReadyState { [DispId(-525)] get; }<br/>
bool RegisterAsBrowser { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x228)] get; [DispId(0x228)] set; }<br/>
bool RegisterAsDropTarget { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x229)] get; [DispId(0x229)] set; }<br/>
bool Resizable { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x22c)] get; [DispId(0x22c)] set; }<br/>
bool Silent { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x227)] get; [DispId(0x227)] set; }<br/>
bool StatusBar { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x193)] get; [DispId(0x193)] set; }<br/>
string StatusText { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x194)] get; [DispId(0x194)] set; }<br/>
bool TheaterMode { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x22a)] get; [DispId(0x22a)] set; }<br/>
int ToolBar { [DispId(0x195)] get; [DispId(0x195)] set; }<br/>
int Top { [DispId(0xcf)] get; [DispId(0xcf)] set; }<br/>
bool TopLevelContainer { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0xcc)] get; }<br/>
string Type { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0xcd)] get; }<br/>
bool Visible { [return: MarshalAs(UnmanagedType.VariantBool)] [DispId(0x192)] get; [DispId(0x192)] set; }<br/>
int Width { [DispId(0xd0)] get; [DispId(0xd0)] set; }<br/>
}
[ComImport, ComVisible(true)]<br/>
[Guid("00000112-0000-0000-C000-000000000046")]<br/>
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br/>
public interface IOleObject<br/>
{<br/>
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetClientSite(<br/>
[In, MarshalAs(UnmanagedType.Interface)] IOleClientSite pClientSite);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetClientSite(<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out IOleClientSite site);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetHostNames(<br/>
[In, MarshalAs(UnmanagedType.LPWStr)] string szContainerApp,<br/>
[In, MarshalAs(UnmanagedType.LPWStr)] string szContainerObj);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int Close([In, MarshalAs(UnmanagedType.U4)] uint dwSaveOption);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetMoniker(<br/>
[In, MarshalAs(UnmanagedType.U4)] int dwWhichMoniker,<br/>
[In, MarshalAs(UnmanagedType.Interface)] IMoniker pmk);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetMoniker(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwAssign,<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwWhichMoniker,<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out IMoniker moniker);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int InitFromData(<br/>
[In, MarshalAs(UnmanagedType.Interface)] System.Runtime.InteropServices.ComTypes.IDataObject pDataObject,<br/>
[In, MarshalAs(UnmanagedType.Bool)] bool fCreation,<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwReserved);
int GetClipboardData(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwReserved,<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out System.Runtime.InteropServices.ComTypes.IDataObject data);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int DoVerb(<br/>
[In, MarshalAs(UnmanagedType.I4)] int iVerb,<br/>
[In, MarshalAs(UnmanagedType.Struct)] ref tagMSG lpmsg,<br/>
//[In] IntPtr lpmsg,<br/>
[In, MarshalAs(UnmanagedType.Interface)] IOleClientSite pActiveSite,<br/>
//[In] IntPtr pActiveSite,<br/>
[In, MarshalAs(UnmanagedType.I4)] int lindex,<br/>
[In] IntPtr hwndParent,<br/>
[In, MarshalAs(UnmanagedType.Struct)] ref tagRECT lprcPosRect);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int EnumVerbs([Out, MarshalAs(UnmanagedType.Interface)] out Object e);<br/>
//int EnumVerbs(out IEnumOLEVERB e);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int OleUpdate();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int IsUpToDate();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetUserClassID([In, Out] ref Guid pClsid);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetUserType(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwFormOfType,<br/>
[Out, MarshalAs(UnmanagedType.LPWStr)] out string userType);
//[return: MarshalAs(UnmanagedType.I4)]<br/>
//[PreserveSig]<br/>
//int SetExtent(<br/>
// [In, MarshalAs(UnmanagedType.U4)] uint dwDrawAspect,<br/>
// [In, MarshalAs(UnmanagedType.Struct)] ref tagSIZEL pSizel);
//[return: MarshalAs(UnmanagedType.I4)]<br/>
//[PreserveSig]<br/>
//int GetExtent(<br/>
// [In, MarshalAs(UnmanagedType.U4)] uint dwDrawAspect,<br/>
// [In, Out, MarshalAs(UnmanagedType.Struct)] ref tagSIZEL pSizel);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int Advise(<br/>
[In, MarshalAs(UnmanagedType.Interface)] IAdviseSink pAdvSink,<br/>
out int cookie);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int Unadvise(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwConnection);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int EnumAdvise(out IEnumSTATDATA e);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetMiscStatus(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwAspect,<br/>
out int misc);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetColorScheme([In, MarshalAs(UnmanagedType.Struct)] ref object pLogpal);<br/>
}
[ComVisible(true), StructLayout(LayoutKind.Sequential)]<br/>
public struct tagMSG<br/>
{<br/>
public IntPtr hwnd;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int message;<br/>
public IntPtr wParam;<br/>
public IntPtr lParam;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int time;<br/>
// pt was a by-value POINT structure<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int pt_x;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int pt_y;<br/>
//public tagPOINT pt;<br/>
}
[ComVisible(true), StructLayout(LayoutKind.Sequential)]<br/>
public struct tagRECT<br/>
{<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int Left;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int Top;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int Right;<br/>
[MarshalAs(UnmanagedType.I4)]<br/>
public int Bottom;
public tagRECT(int left_, int top_, int right_, int bottom_)<br/>
{<br/>
Left = left_;<br/>
Top = top_;<br/>
Right = right_;<br/>
Bottom = bottom_;<br/>
}<br/>
}
[ComImport, ComVisible(true)]<br/>
[Guid("00000118-0000-0000-C000-000000000046")]<br/>
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br/>
public interface IOleClientSite<br/>
{<br/>
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SaveObject();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetMoniker(<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwAssign,<br/>
[In, MarshalAs(UnmanagedType.U4)] uint dwWhichMoniker,<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out IMoniker ppmk);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetContainer(<br/>
[Out, MarshalAs(UnmanagedType.Interface)] out IOleContainer ppContainer);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int ShowObject();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int OnShowWindow([In, MarshalAs(UnmanagedType.Bool)] bool fShow);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int RequestNewObjectLayout();<br/>
}
[ComImport(), ComVisible(true),<br/>
Guid("0000011B-0000-0000-C000-000000000046"),<br/>
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]<br/>
public interface IOleContainer<br/>
{<br/>
//IParseDisplayName<br/>
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int ParseDisplayName(<br/>
[In, MarshalAs(UnmanagedType.Interface)] object pbc,<br/>
[In, MarshalAs(UnmanagedType.BStr)] string pszDisplayName,<br/>
[Out, MarshalAs(UnmanagedType.LPArray)] int[] pchEaten,<br/>
[Out, MarshalAs(UnmanagedType.LPArray)] object[] ppmkOut);
//IOleContainer<br/>
//[return: MarshalAs(UnmanagedType.I4)]<br/>
//[PreserveSig]<br/>
//int EnumObjects(<br/>
// [In, MarshalAs(UnmanagedType.U4)] tagOLECONTF grfFlags,<br/>
// out IEnumUnknown ppenum);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int LockContainer(<br/>
[In, MarshalAs(UnmanagedType.Bool)] Boolean fLock);<br/>
}
public enum tagOLECONTF<br/>
{<br/>
OLECONTF_EMBEDDINGS = 1,<br/>
OLECONTF_LINKS = 2,<br/>
OLECONTF_OTHERS = 4,<br/>
OLECONTF_ONLYUSER = 8,<br/>
OLECONTF_ONLYIFRUNNING = 16<br/>
}<br/>
[ComVisible(true), ComImport(),<br/>
Guid("00000113-0000-0000-C000-000000000046"),<br/>
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]<br/>
public interface IOleInPlaceObject<br/>
{<br/>
//IOleWindow<br/>
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int GetWindow([In, Out] ref IntPtr phwnd);
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int ContextSensitiveHelp([In, MarshalAs(UnmanagedType.Bool)] bool<br/>
fEnterMode);
//IOleInPlaceObject<br/>
void InPlaceDeactivate();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int UIDeactivate();
[return: MarshalAs(UnmanagedType.I4)]<br/>
[PreserveSig]<br/>
int SetObjectRects(<br/>
[In, MarshalAs(UnmanagedType.Struct)] ref tagRECT lprcPosRect,<br/>
[In, MarshalAs(UnmanagedType.Struct)] ref tagRECT lprcClipRect);
void ReactivateAndUndo();<br/>
}
public enum tagREADYSTATE<br/>
{<br/>
READYSTATE_UNINITIALIZED = 0,<br/>
READYSTATE_LOADING = 1,<br/>
READYSTATE_LOADED = 2,<br/>
READYSTATE_INTERACTIVE = 3,<br/>
READYSTATE_COMPLETE = 4<br/>
}<br/>
public enum OLECMDF<br/>
{<br/>
OLECMDF_SUPPORTED = 1,<br/>
OLECMDF_ENABLED = 2,<br/>
OLECMDF_LATCHED = 4,<br/>
OLECMDF_NINCHED = 8,<br/>
OLECMDF_INVISIBLE = 16,<br/>
OLECMDF_DEFHIDEONCTXTMENU = 32<br/>
}<br/>
public enum OLECMDID<br/>
{<br/>
OLECMDID_OPEN = 1,<br/>
OLECMDID_NEW = 2,<br/>
OLECMDID_SAVE = 3,<br/>
OLECMDID_SAVEAS = 4,<br/>
OLECMDID_SAVECOPYAS = 5,<br/>
OLECMDID_PRINT = 6,<br/>
OLECMDID_PRINTPREVIEW = 7,<br/>
OLECMDID_PAGESETUP = 8,<br/>
OLECMDID_SPELL = 9,<br/>
OLECMDID_PROPERTIES = 10,<br/>
OLECMDID_CUT = 11,<br/>
OLECMDID_COPY = 12,<br/>
OLECMDID_PASTE = 13,<br/>
OLECMDID_PASTESPECIAL = 14,<br/>
OLECMDID_UNDO = 15,<br/>
OLECMDID_REDO = 16,<br/>
OLECMDID_SELECTALL = 17,<br/>
OLECMDID_CLEARSELECTION = 18,<br/>
OLECMDID_ZOOM = 19,<br/>
OLECMDID_GETZOOMRANGE = 20,<br/>
OLECMDID_UPDATECOMMANDS = 21,<br/>
OLECMDID_REFRESH = 22,<br/>
OLECMDID_STOP = 23,<br/>
OLECMDID_HIDETOOLBARS = 24,<br/>
OLECMDID_SETPROGRESSMAX = 25,<br/>
OLECMDID_SETPROGRESSPOS = 26,<br/>
OLECMDID_SETPROGRESSTEXT = 27,<br/>
OLECMDID_SETTITLE = 28,<br/>
OLECMDID_SETDOWNLOADSTATE = 29,<br/>
OLECMDID_STOPDOWNLOAD = 30,<br/>
OLECMDID_ONTOOLBARACTIVATED = 31,<br/>
OLECMDID_FIND = 32,<br/>
OLECMDID_DELETE = 33,<br/>
OLECMDID_HTTPEQUIV = 34,<br/>
OLECMDID_HTTPEQUIV_DONE = 35,<br/>
OLECMDID_ENABLE_INTERACTION = 36,<br/>
OLECMDID_ONUNLOAD = 37,<br/>
OLECMDID_PROPERTYBAG2 = 38,<br/>
OLECMDID_PREREFRESH = 39,<br/>
OLECMDID_SHOWSCRIPTERROR = 40,<br/>
OLECMDID_SHOWMESSAGE = 41,<br/>
OLECMDID_SHOWFIND = 42,<br/>
OLECMDID_SHOWPAGESETUP = 43,<br/>
OLECMDID_SHOWPRINT = 44,<br/>
OLECMDID_CLOSE = 45,<br/>
OLECMDID_ALLOWUILESSSAVEAS = 46,<br/>
OLECMDID_DONTDOWNLOADCSS = 47,<br/>
OLECMDID_UPDATEPAGESTATUS = 48,<br/>
OLECMDID_PRINT2 = 49,<br/>
OLECMDID_PRINTPREVIEW2 = 50,<br/>
OLECMDID_SETPRINTTEMPLATE = 51,<br/>
OLECMDID_GETPRINTTEMPLATE = 52,<br/>
OLECMDID_PAGEACTIONBLOCKED = 55,<br/>
OLECMDID_PAGEACTIONUIQUERY = 56,<br/>
OLECMDID_FOCUSVIEWCONTROLS = 57,<br/>
OLECMDID_FOCUSVIEWCONTROLSQUERY = 58,<br/>
OLECMDID_SHOWPAGEACTIONMENU = 59,<br/>
OLECMDID_ADDTRAVELENTRY = 60,<br/>
OLECMDID_UPDATETRAVELENTRY = 61,<br/>
OLECMDID_UPDATEBACKFORWARDSTATE = 62,<br/>
OLECMDID_OPTICAL_ZOOM = 63,<br/>
OLECMDID_OPTICAL_GETZOOMRANGE = 64,<br/>
OLECMDID_WINDOWSTATECHANGED = 65,<br/>
//OLECMDID_IE7_SHOWSCRIPTERROR = 69<br/>
}<br/>
public enum OLECMDEXECOPT<br/>
{<br/>
OLECMDEXECOPT_DODEFAULT = 0,<br/>
OLECMDEXECOPT_PROMPTUSER = 1,<br/>
OLECMDEXECOPT_DONTPROMPTUSER = 2,<br/>
OLECMDEXECOPT_SHOWHELP = 3<br/>
}<br/>
}
View the full article