need help for CefV8Value.ExecuteFunction Method

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

need help for CefV8Value.ExecuteFunction Method

Postby duoixi » Mon Jun 03, 2013 9:55 pm

use cef_3.1453.1255,cefglue-b22787699e57

the code run in the Render process;

Code: Select all
CefV8Context v8context = _browser.GetMainFrame().V8Context;
CefV8Value v8vlaue = v8context.GetGlobal();
CefV8Value arg = CefV8Value.CreateString("return '11';");
CefV8Value[] args = new CefV8Value[1];
args[0] = arg;
CefV8Value returnvalue=v8vlaue.ExecuteFunction(null, args);
Console.WriteLine("javascript return:" + returnvalue);


I need the return value,but no return value.

Any guidance would be appreciated, thanks!

duoixi
duoixi
Techie
 
Posts: 18
Joined: Sat May 18, 2013 8:28 pm

Re: need help for CefV8Value.ExecuteFunction Method

Postby fddima » Tue Jun 04, 2013 2:28 am

ExecuteFunction method can be used to call function, on function-object.
I.e. your's v8vlaue.IsFunction must be true.
You can create or obtain (eval?) function and execute it, or similar.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: need help for CefV8Value.ExecuteFunction Method

Postby duoixi » Tue Jun 04, 2013 4:19 am

fddima wrote:ExecuteFunction method can be used to call function, on function-object.
I.e. your's v8vlaue.IsFunction must be true.
You can create or obtain (eval?) function and execute it, or similar.


Thank you Reply.

Can you give me an example of it ?
duoixi
Techie
 
Posts: 18
Joined: Sat May 18, 2013 8:28 pm

Re: need help for CefV8Value.ExecuteFunction Method

Postby fddima » Tue Jun 04, 2013 4:34 am

Look around on cefclient code for examples.
In general you doing all right.

Code: Select all
CefV8Context v8context = _browser.GetMainFrame().V8Context;
CefV8Value v8vlaue = v8context.GetGlobal();
CefV8Value eval = v8value.GetValue("eval");

// try to call eval as you do it before
// eval.ExecuteFunction(null, ...);

fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: need help for CefV8Value.ExecuteFunction Method

Postby duoixi » Thu Jun 06, 2013 2:14 am

fddima wrote:Look around on cefclient code for examples.
In general you doing all right.

Code: Select all
CefV8Context v8context = _browser.GetMainFrame().V8Context;
CefV8Value v8vlaue = v8context.GetGlobal();
CefV8Value eval = v8value.GetValue("eval");

// try to call eval as you do it before
// eval.ExecuteFunction(null, ...);



Thanks!

i use Window Binding substitute it.
duoixi
Techie
 
Posts: 18
Joined: Sat May 18, 2013 8:28 pm


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 16 guests