Based on this answer, I am trying to override the OnShowWindow TOleContainer method 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 will not compile the following error: [Error] MyOleContainer.pas(11): Field definition not allowed after methods or properties Why?
Edit:
Could you explain how to "declare an implementation of IOleClientSite, inherit from TOleContainer and hide the OnShowWindow method [...] use TOleContainer as IOleClientSite"?
Edit2:
Is that 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; ...
source share