![](/img/trans.png)
[英]How to attach an event to IHTMLDocument2 link elements in Delphi?
[英]How to find if an IHTMLDocument2 is equal to IDispatch document in Delphi?
我有一個帶有iFrame的TEmbeddedWB( https://sourceforge.net/projects/embeddedwb/ )。 我必須找出特定的HTML標簽是否在iFrame內部。 我的iFrame對象是IHTMLFrameBase2
,而Tag是IHTMLElement
。 我知道iFrame.contentWindow.document
(這是一個IHTMLDocument2
)是一樣的Tag.document
。 但Tag.document
是一個IDispatch對象,因此下面給出了一個false:
if iFrame.contentWindow.document = Tag.document then ShowMessage('In iFrame')
else ShowMessage('Not in iFrame');
我知道這兩個對象是一樣的,因為Watch List可以顯示它們的內存地址:
但是我無法從代碼中獲取他們的地址。 我嘗試過的:
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
注意:如果我逐行運行監視列表顯示的地址在每行代碼后都會發生變化,無論代碼是否影響WebBrowser。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.