翻譯|其它|編輯:郝浩|2006-06-26 13:58:00.000|閱讀 2070 次
概述:
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
程序代碼如下所示:
using System;
using System.Runtime.InteropServices;
namespace d4htmlinterface
{
/**//// <summary>
/// Class1 的摘要說明。
/// </summary>
public class htmlinterface
{
public htmlinterface()
{
//
// TODO: 在此處添加構(gòu)造函數(shù)邏輯
//
}
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
public struct OLECMDTEXT
{
public uint cmdtextf;
public uint cwActual;
public uint cwBuf;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=100)]public
char rgwz;
}
[StructLayout(LayoutKind.Sequential)]
public struct OLECMD
{
public uint cmdID;
public uint cmdf;
}
// Interop definition for
IOleCommandTarget.
[ComImport,
Guid("b722bccb-4e68-101b-a2bc-00aa00404770"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface 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,
ref object pvaIn, ref object pvaOut);
}
}
}
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn