How to use CEF in a headless manner within an application?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

How to use CEF in a headless manner within an application?

Postby AnnabelleLee » Fri Apr 06, 2018 7:23 pm

Hi! So, I looked at the sample app and examples and such. But I'll be honest I'm a bit out of depth in understanding those, they seem easy enough, but I'm not exactly sure how to adapt the code into using it without displaying anything in my application. So a bit of background is that my application is in C++, using Visual Studio. All I want to be able to do is navigate to a page, input something in a Textbox on a site, click a button and get a response for it.

So the main problem I'm having is I'm not sure how to organize my event loop, and make the CEF instance into a pure headless mode without having a display like the sample app. If someone can guide me on how to simply do that, I'd appreciate it.

I have a WinForms application in C++, and as such this is my main current file:

Code: Select all
#include "MyForm.h"

using namespace System;
using namespace System::Windows::Forms;

[STAThreadAttribute]
void Main(array<String^>^ args) {
   Application::EnableVisualStyles();
   Application::SetCompatibleTextRenderingDefault(false);
   XTurbo::MyForm form;
   Application::Run(%form);
}


Where would I input the code for the CEF? If someone can guide me to start out, I'm sure I'll be fine with the actual details. Thanks in advance!
AnnabelleLee
Newbie
 
Posts: 1
Joined: Fri Apr 06, 2018 7:11 pm

Re: How to use CEF in a headless manner within an applicatio

Postby rado » Sat Apr 14, 2018 6:57 am

Since you are using managed C++ to make WinForms application I would use CefSharp (or maybe CefGlue) otherwise you would have to reinvent what those wrappers do.
rado
Expert
 
Posts: 145
Joined: Wed Oct 05, 2011 3:32 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 29 guests