Having found the DHTED looked

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;

posted @ 2005-08-23 02:16  小洋房  阅读(336)  评论(0)    收藏  举报