I’m writing a Browser Helper Object (BHO) for Internet Explorer in C#!
I want to look for text nodes in the DOM, which requires me to traverse the whole DOM tree if I want to differentiate between text nodes and other types of nodes. This is supposedly time consuming in C#, but should be almost instantanious in C++ (?).
Is there a way to do the traversing in c++ instead? A dll that I can call from C# perhaps, using DllImport? Is it easy to pass the HTMLDocument to my externally exposed c++-method?
Any other ideas?
Cheers!
Where did you get the “supposedly” from? Most of the time will be spent in the code that implements the DOM. Which was written in C++ by Microsoft.
Marshal.GetIUnknownForObject() gets you a raw interface pointer that you can pass to native code. It needs to QI that pointer for IHtmlDocument2 and take it from there.