Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

346
Views
CEF: cómo obtener una variable de JS a С ++

Por favor, ayúdenme, he estado sufriendo durante dos semanas, no puedo entender si es posible en CEF obtener el valor de una variable del código JS a una variable C++.

Por ejemplo:

Estoy ejecutando código js en una ventana del navegador usando el método CefFrame::ExecuteJavaScript:

 (*frame).GetMainFrame()).ExecuteJavaScript("const elem = document.getElementsByClassName("my_class")[0];const rect = elem.getBoundingClientRect(); alert(rect.x + \":\" + rect.y)", "", 1);

Y todo funciona muy bien, pero solo "dentro" de javascript.

Aquí está la pregunta: ¿es posible obtener de alguna manera el valor de una variable en rect.x para extraer y colocar una variable de C++ int rect_x ?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Es posible que haya notado que, si escribe rect.x en la consola en las herramientas de desarrollo, se repite el valor de la variable. Debería haberte dado una pista sobre cómo recuperar valores de variables.

 CefRefPtr<CefV8Context> v8_context = frame->GetMainFrame()->GetV8Context(); if (v8_context.get() && v8_context->Enter()) { CefRefPtr<CefV8Value> retval; CefRefPtr<CefV8Exception> exception; if (v8_context->Eval("rect.x", "", 0, retval, exception)) { int rect_x = retval->GetIntValue() } v8_context->Exit(); }
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!