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

    技术2022-05-11  149

    Having found the DHTMLEdit looked ideal solution except this "Unknowninterface"Think I have a potential solution (not as nice as I would like due toissues overriding interfaces :s)Here is what I have done in Delphi 7:Save a copy of OleCtrls.pas in your projects dir. modify theTOleControl definition - add interface IOleContainer - should looksomething like this:TOleControl = class(TWinControl, IUnknown, IOleClientSite,IOleControlSite, IOleInPlaceSite, IOleInPlaceFrame, IDispatch,IPropertyNotifySink, ISimpleFrameSite, IOleContainer)Add the following to the protected section of TOleControl//IOleContainerfunction 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 implementationfunction 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;beginResult := E_NOTIMPL;end;finally change TOleControl.GetContainer tofunction TOleControl.GetContainer(out container: IOleContainer):HResult;begin  container:= Self;  Result:= S_OK;end;

    最新回复(0)