Click here to Skip to main content
15,921,279 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I'm having trouble working with TWebBrowser in RAD Studio Xe8 C++ builder.

I can't figure out how to access elements on a webpage, like reading the content of an input field...
All the relevant examples that I've found are in Delphi, I tried using this WebBrowser1->Document->getElementByID("input1")
But the method isn't a member of Document which type is IDispatch and I don't know what that is, Can I access the methods that I'm looking for through this IDispatch class? or am I on the wrong path?

Any simple code would be nice.
Thank you in advance

What I have tried:

C++
WebBrowser1->Document->getElementByID("input1")

IHTMLDocument2 *Doc = dynamic_cast<IHTMLDocument2 *>(WebBrowser1->Document);

IHTMLDocument2 *Doc;
Doc=(IHTMLDocument2)WebBrowser1->Document;
Posted
Updated 21-Jul-17 3:18am
v2

1 solution

You must acquire the correct interface to call the method.

This should work, but should access the website at the correct handler, like OnDocumentComplete.

Look like here is some helping code to understand the Document and the access to its content. (I didnt find anything better)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900