
Zitat von
marabu:
Delphi-Quellcode:
function TForm1.QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
begin
Result := S_OK;
if IsEqualGUID(IID, IID_IElementBehaviorFactory) then
IInterface(Obj) := self as IElementBehaviorFactory else
if IsEqualGUID(IID, IID_IElementBehavior) then
IInterface(Obj) := self as IElementBehavior else
if IsEqualGUID(IID, IID_IHTMLPainter) then
IInterface(Obj) := self as IHTMLPainter else
Result := inherited QueryInterface(IID, Obj);
end;
marabu
Ojee ja genau... Wusste nicht, das man auch auf der zuweisenden Seite Typcasten kann.
Folgende events kommen in dieser Procedure in dieser Reihenfolge an:
Delphi-Quellcode:
IID_IElementBehaviorFactory:{3050F429-98B5-11CF-BB82-00AA00BDCE0B}
IID_IElementBehavior:{3050F425-98B5-11CF-BB82-00AA00BDCE0B}
IID_IProxyManager:TGUID ='{00000008-0000-0000-C000-000000000046}'
??? {3050F4FA-98B5-11CF-BB82-00AA00BDCE0B}
IID_IPersistPropertyBag2:TGUID ='{22F55881-280B-11D0-A8A9-00A0C90C2004}'
IID_IPersistPropertyBag:TGUID ='{37D84F60-42CB-11CE-8135-00AA004BB851}'
IID_CPC:TGUID = '{B196B284-BAB4-101A-B69C-00AA00341D07}'
IID_IHTMLPainter:{3050F6A6-98B5-11CF-BB82-00AA00BDCE0B}
??? {3050F6DE-98B5-11CF-BB82-00AA00BDCE0B}
IID_IHTMLPainterOverlay: TGUID = '{3050F7E3-98B5-11CF-BB82-00AA00BDCE0B}';
IID_IHTMLPainterEventInfo: TGUID = '{3050F6DF-98B5-11CF-BB82-00AA00BDCE0B}';
IID_IElementBehaviorCategory: TGUID = '{3050F4ED-98B5-11CF-BB82-00AA00BDCE0B}';
IID_IOleCommandTarget = "{B722BCCB-4E68-101B-A2BC-00AA00404770}"
IID_IElementBehaviorLayout: TGUID = '{3050F6BA-98B5-11CF-BB82-00AA00BDCE0B}';
Leider wird die IHTMLPainter.Draw nie aufgerufen...
Hast Du noch eine Idee?
Ach ja die Behavior setze ich so: (Ich hasse Interfaces)
Delphi-Quellcode:
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch;
var URL: OleVariant);
var
vFactory : OleVariant;
Body : IHTMLElement;
Body2 : IHTMLElement2;
Doc : IHTMLDocument2;
begin
(Webbrowser1.Document
as IHTMLDocument2).designMode := '
on';
(Webbrowser1.Document
as IHTMLDocument2).execCommand('
2D-Position', false,true);
(Webbrowser1.Document
as IHTMLDocument2).execCommand('
MULTIPLESELECTION',false,true);
(Webbrowser1.Document
as IHTMLDocument2).execCommand('
Liveresize',false,true);
Doc := (Webbrowser1.Document
as IHTMLDocument2);
Body := Doc.createElement('
body');
if Body =
NIL then
exit;
Body.QueryInterface(IID_IHTMLElement2,Body2);
if Body2 =
NIL then
begin
Body._Release;
exit;
end;
VFactory := IElementBehaviorFactory(Self);
Body2.addBehavior('
',vFactory);
Body._Release;
Body2._Release;
end;
mfg Frank