Basing on this answer I'm trying to override OnShowWindow
method of TOleContainer
in Delphi 7.
unit MyOleContainer;
interface
uses
Windows, OleCtnrs;
type
TOleContainer = class(OleCtnrs.TOleContainer)
private
function OnShowWindow(fShow: BOOL): HResult; stdcall; override;
end;
implementation
function TOleContainer.OnShowWindow(fShow: BOOL): HResult;
begin
Result := S_OK;
end;
end.
But this won't compile giving following error: [Error] MyOleContainer.pas(11): Field definition not allowed after methods or properties
Why?
Edit:
Could you please explain how to "declare implementation of IOleClientSite, inherit from TOleContainer and hide the method OnShowWindow [...] use a TOleContainer as IOleClientSite"?
Edit2:
Is this what you meant?
TMyContainer = class(TOleContainer, IOleClientSite)
private
FIOleClientSite: IOleClientSite;
function SaveObject: HResult; stdcall;
...
constructor TMyContainer.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Self.OleObjectInterface.GetClientSite(FIOleClientSite);
end;
function TMyContainer.SaveObject: HResult;
begin
Result := FIOleClientSite.SaveObject;
end;
...