PASSWORD 's Blog

用耳朵去聆听,用心来感受

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

新一篇: 两层还是三层? | 旧一篇: 为什么CSDN的BLOG老是不正常

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;

发表于 @ 2005年12月28日 14:27:00|评论(loading...)|编辑

新一篇: 两层还是三层? | 旧一篇: 为什么CSDN的BLOG老是不正常

评论:没有评论。

发表评论  


当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
Csdn Blog version 3.1a
Copyright © 彭为