using System; using System.Runtime.InteropServices; namespace d4htmlinterface { /**////<summary> /// Class1 的摘要说明。 ///</summary> publicclass htmlinterface { public htmlinterface() { // // TODO: 在此处添加构造函数逻辑 // } [StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)] publicstruct OLECMDTEXT { publicuint cmdtextf; publicuint cwActual; publicuint cwBuf; [MarshalAs(UnmanagedType.ByValTStr,SizeConst=100)]publicchar rgwz; } [StructLayout(LayoutKind.Sequential)] publicstruct OLECMD { publicuint cmdID; publicuint cmdf; } // Interop definition for IOleCommandTarget. [ComImport, Guid("b722bccb-4e68-101b-a2bc-00aa00404770"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] publicinterface IOleCommandTarget { //IMPORTANT: The order of the methods is critical here. You //perform early binding in most cases, so the order of the methods //here MUST match the order of their vtable layout (which is determined //by their layout in IDL). The interop calls key off the vtable ordering, //not the symbolic names. Therefore, if you //switched these method declarations //and tried to call the Exec method //on an IOleCommandTarget interface from your //application, it would translate //into a call to the QueryStatus method instead. void QueryStatus(ref Guid pguidCmdGroup, UInt32 cCmds, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] OLECMD[] prgCmds, ref OLECMDTEXT CmdText); void Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdExecOpt, refobject pvaIn, refobject pvaOut); } } }