Код: Выделить всё
uses ActiveX, Mshtml;
type
TSinkObj = class (TInterfacedObject, IDispatch, IPropertyNotifySink,
IOleClientSite)
procedure ...
var
Doc : IHTMLDocument2;
Sink : TSinkObject;
ConnectionPoint : IConnectionPoint;
Cookie : integer;
begin
Sink := TSinkObj.Create;
if not Succeeded ( CoCreateInstance(CLASS_HTMLDocument,
nil, CLSCTX_INPROC_SERVER ,IHTMLDocument2, Doc) ) then
error('Create Instance');
(Doc as IOleObject).SetClientSite(sink as IOleClientsite);
(Doc as IOleControl).OnAmbientPropertyChange(DISPID_AMBIENT_DLCONTROL);
(Doc as IConnectionPointContainer).FindConnectionPoint(IpropertyNotifySink, ConnectionPoint);
ConnectionPoint.Advise(Sink as IPropertyNotifySink, Cookie);
// здесь делаем кое что с Doc
(Doc as IOleObject).SetClientSite(nil);
ConnectionPoint.Unadvise(Cookie);
Sink.Destroy;
end;
может подскажите что не так
