D
D
Denis2020-04-09 19:54:18
C++ / C#
Denis, 2020-04-09 19:54:18

Why is the simplest C++ and CEF project not displaying the page?

Collected under virtualka CEF. Test projects like cefsimple are up and running!
Created a new project for VS2019CE. Minimum code:

#include <Windows.h>

#include <include/cef_app.h>
#include <include/cef_client.h>
#include <include/wrapper/cef_helpers.h>

class Handler : public CefClient {
  IMPLEMENT_REFCOUNTING(Handler);
};

class App : public CefApp, public CefBrowserProcessHandler {
public:
  CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override {
    return this;
  }

  void OnContextInitialized() override {
    CEF_REQUIRE_UI_THREAD();

    CefRefPtr<Handler> handler(new Handler);

    CefWindowInfo wndInfo;
    wndInfo.SetAsPopup(NULL, "Hello world");

    CefBrowserSettings settings;
    CefBrowserHost::CreateBrowser(wndInfo, handler, "http://toster.ru", settings, nullptr, nullptr);
  }

public:
  IMPLEMENT_REFCOUNTING(App);
};

int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) {
  CefEnableHighDPISupport();

  CefMainArgs args{ hInstance };
  CefRefPtr<App> app = new App;

  int ec = CefExecuteProcess(args, app, nullptr);
  if (ec >= 0) {
    return ec;
  }

  CefSettings settings;
  CefInitialize(args, settings, app.get(), nullptr);
  CefRunMessageLoop();
  CefShutdown();

  return 0;
}


The project compiles, starts, but I don't see the desired site - a white window and that's it.

Threat I sawed out all the source codes from the test project (cefsimple) and inserted my own. Collected. Launched. Everything is ok %)
I compared all the options of the compiler, linker - nothing is different.

How so? Where to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2020-04-11
@denisk0n

Understood. Added manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
    </dependentAssembly>
  </dependency>

  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!--The ID below indicates application support for Windows Vista -->
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
      <!--The ID below indicates application support for Windows 7 -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
      <!--The ID below indicates application support for Windows 8 -->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
      <!--The ID below indicates application support for Windows 8.1 -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
      <!--The ID below indicates application support for Windows 10 -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
    </application>
  </compatibility>

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" />
      </requestedPrivileges>
    </security>
  </trustInfo>

</assembly>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question