如何解决 DHtmlEdit 提示"不支持此接口" (DELPHI)

Having found the DHTMLEdit looked ideal solution except this "Unknown
interface"

Think I have a potential solution (not as nice as I would like due to
issues overriding interfaces :s)

Here is what I have done in Delphi 7:

Save a copy of OleCtrls.pas in your projects dir. modify the
TOleControl definition - add interface IOleContainer - should look
something like this:

TOleControl = class(TWinControl, IUnknown, IOleClientSite,
IOleControlSite, IOleInPlaceSite, IOleInPlaceFrame, IDispatch,
IPropertyNotifySink, ISimpleFrameSite, IOleContainer)

Add the following to the protected section of TOleControl

//IOleContainer
function EnumObjects(grfFlags: Longint; out Enum: IEnumUnknown):
HResult; stdcall;
function LockContainer(fLock: BOOL): HResult; stdcall;
function ParseDisplayName(const bc: IBindCtx; pszDisplayName:
POleStr; out chEaten: Longint; out mkOut: IMoniker): HResult; stdcall;

and the corresponding implementation

function TOleControl.EnumObjects(grfFlags: Integer;
out Enum: IEnumUnknown): HResult;
begin
  Result := E_NOTIMPL;
end;

function TOleControl.LockContainer(fLock: BOOL): HResult;
begin
  Result := E_NOTIMPL;
end;

function TOleControl.ParseDisplayName(const bc: IBindCtx;
pszDisplayName: POleStr; out chEaten: Integer;
out mkOut: IMoniker): HResult;
begin
Result := E_NOTIMPL;
end;


finally change TOleControl.GetContainer to

function TOleControl.GetContainer(out container: IOleContainer):
HResult;
begin
  container:= Self;
  Result:= S_OK;
end;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值