Home > Software engineering >  Questions about the cef, a great god, please help?
Questions about the cef, a great god, please help?

Time:10-19

The younger brother is cef rookie, don't know how to reference the following function, that is to say CefBrowser: : CreateBrowser (info, static_cast & lt; CefRefPtr (the client),
"Http://www.baidu.com", browserSettings); How to get the CefRefPtr< after; CefDOMDocument> Document), to obtain a great god help
 void DomVisitTestor: : TestModify (CefRefPtr The document) 
{
OutputDebugStringW (L "DomVisitTestor: : TestModify \ r \ n");
CefRefPtr BodyNode=document - & gt; GetBody ();
If (bodyNode - & gt; The HasChildren ())
{
CefRefPtr ChildNode=bodyNode - & gt; GetFirstChild ();
Would be szLog [512]={0};
Do {
Swprintf_s (szLog, 256, L "node name - % s, tagName - type - % d, % s value - % s \ r \ n",
ChildNode - & gt; GetName (). ToWString (.) c_str (),
ChildNode - & gt; GetElementTagName (). ToWString (.) c_str (),
ChildNode - & gt; GetType (), childNode - & gt; GetValue ());
OutputDebugStringW (szLog);
If (childNode - & gt; IsElement () & amp; & ChildNode - & gt; GetElementTagName ()=="H1"
& & ChildNode - & gt; GetElementAttribute (" id ")=="hello")
{
CefRefPtr TextNode=childNode - & gt; GetFirstChild ();
Swprintf_s (szLog, 512, L found "hello, text - % s \ r \ n", textNode - & gt; GetValue (). ToWString (.) c_str ());
OutputDebugStringW (szLog);
TextNode - & gt; SetValue (" Hello World Modified!" );
break;
}
} while ((childNode=childNode - & gt; GetNextSibling ()). The get ());
}

CefRefPtr Hello=document - & gt; GetElementById (" hello ");
If (hello. The get ())
{
Hello - & gt; SetElementAttribute (" align ", "center");
OutputDebugStringW (L "Change hello align \ r \ n");
}
}
  • Related