I have a TEmbeddedWB ( https://sourceforge.net/projects/embeddedwb/ ) with an iFrame in it. I have to find out if a certain HTML tag is inside the iFrame or not. My iFrame is an IHTMLFrameBase2 object and the tag is IHTMLElement . I know that iFrame.contentWindow.document (which is IHTMLDocument2 ) is the same as Tag.document . But Tag.document is an IDispatch object, so the following gives false:
if iFrame.contentWindow.document = Tag.document then ShowMessage('In iFrame') else ShowMessage('Not in iFrame');
I know that both objects are the same because the watchlist can display its memory address:

But I can not get their addresses from the code. What I tried:
Addr(iFrame.contentWindow.document) // Gives variable required error @iFrame.contentWindow.document // Gives variable required error Pointer(iFrame.contentWindow.document) //Compiles, but gives wrong address Format('%p',[iFrame.contentWindow.document]) //Compiles, but gives EConvertError
Note. If I run line by line, the addresses displayed in the watchlist change after each line of code, whether the code affects WebBrowser or not.
delphi iframe
Fenistil
source share