CreateBrowser window focus

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.

CreateBrowser window focus

Postby rashid301 » Wed Oct 15, 2014 11:10 am

Hi all,
I am using
Code: Select all
CefBrowserHost::CreateBrowser()
to create a notification in the system tray. It works fine when the main window is open(active/inactive both). When I close the main window, it runs in the background. Now when I get a notification, thee CreateBrowser steals the focus of the window from the ForegroundWindow. Is there a way to create a browser and display it without stealing the focus from the other window?
rashid301
Techie
 
Posts: 13
Joined: Wed Oct 15, 2014 11:04 am

Re: CreateBrowser window focus

Postby magreenblatt » Wed Oct 15, 2014 12:35 pm

Implement CefFocusHandler::OnSetFocus and return true.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CreateBrowser window focus

Postby rashid301 » Wed Oct 15, 2014 1:31 pm

Sorry, I am new to CEF. What you are saying is create a class that implements CefFocusHandler and send it as some argument? Could you please elaborate?
rashid301
Techie
 
Posts: 13
Joined: Wed Oct 15, 2014 11:04 am

Re: CreateBrowser window focus

Postby magreenblatt » Wed Oct 15, 2014 1:45 pm

Implement the CefFocusHandler interface. Return an instance from CefClient::GetFocusHandler. See the cefclient or cefsimple sample application for reference.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CreateBrowser window focus

Postby sunswam » Fri Jan 13, 2017 5:52 pm

Implementing CefFocusHandler with OnSetFocus returning "true" is not fixing the steal focus problem. I am using CEF3 ver. 2704. Is there any additional work to be done?. Is this because CEF calls SetForeGroundWindow API . I can only prevent the steal focus by doing a LockSetForegroundWindow - lock/unlock around the code when browser window is created. Any advise?
sunswam
Newbie
 
Posts: 7
Joined: Fri Jan 13, 2017 5:35 pm

Re: CreateBrowser window focus

Postby magreenblatt » Tue Jan 17, 2017 11:06 am

magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 65 guests