Integrating an Auto-Hide Application

Made a cool mod to CEF that you'd like to share with others? Discuss CEF modifications here, and view modifications that others have made.

Integrating an Auto-Hide Application

Postby SynapseJumps » Sun Feb 14, 2016 11:52 am

Hey Everybody,

I'm trying to create a web-application with a "restricted view" by leveraging CEF. I started with cef_binary_3.2171.1979_windows32 and spun off CEFSimple for my own needs. Since then, I've got CEFSimple to "restrict" the functions I want (no right clicking, etc) mostly by over-riding the CefClient Class (over-riding OnBeforeContextMenu, for example). Now, though, I'm trying to get the browser window to auto-hide. That is, I'm trying to make the browser similar to the windows taskbar when autohiding is turned on: It should appear when the mouse ventures into the region, and dock itself when the mouse moves away.

I got a real jump-start on this feature when I found an AutoHotkey script (https://github.com/BoD/winautohide) that almost did all the work for me. I'm trying to finish up the integration of a script extremely similar to the linked script with my program and I'm having a bit of trouble telling the AutoHide application which HWND's it needs to show/hide.

Currently, I'm just passing my auto-hide application the window handle of the first browser that I create in CEF Simple, ie:
Code: Select all
void CEFSimple:OnContextInitialized() {

  ...

  // Create the first browser window.
  CefBrowserHost::CreateBrowser(window_info, handler.get(), url,
                                browser_settings, NULL);

  // Wait for a moment to make sure the window_info window is valid
  Sleep(300);

  // Launch the auto-hider process...
  sprintf(cBuffer, "winautohide.exe %d", (int)window_info.window);
  CreateProcessA("winautohide.exe", cBuffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);


This works surprisingly... decently. Not perfectly. Decently. When I implement this way, though, I get some strange errors with the rendering in my web application. All the borders to <select> menus and my scroll bars, for example, show up as red -- see the attachment. Note that the red scroll bar on the right should just be a normal scroll bar. I don't know why it shows up red.

I imagine that it has something to do with my auto-hider, though. If I build the project without the auto-hider code -- that is, if I comment out the CreateProcessA shown above -- my scroll bars look fine. Is it possible that I'm not hiding/unhiding all the windows that I should be? Maybe I need to get the renderer window, also? Can somebody please offer some pointers on finding that renderer window? Maybe it's just as easy as over-riding a renderer function?

Any suggestions are appreciated.

Thanks!
- Syn
Attachments
red-scroller.PNG
red-scroller.PNG (17.75 KiB) Viewed 10647 times
SynapseJumps
Newbie
 
Posts: 9
Joined: Mon May 11, 2015 5:36 pm

Re: Integrating an Auto-Hide Application

Postby amaitland » Sun Feb 14, 2016 8:17 pm

Does the problem reproduce with the latest release version? `2526` is the current stable branch.

`2171` is at least 12 months out of date.

See https://cefbuilds.com/ for newer binaries.
Maintainer of the CefSharp project.
amaitland
Master
 
Posts: 710
Joined: Wed Jan 14, 2015 2:35 am

Re: Integrating an Auto-Hide Application

Postby magreenblatt » Sun Feb 14, 2016 9:01 pm

Red scrollbar usually means you're missing cef.pak.
magreenblatt
Site Admin
 
Posts: 9838
Joined: Fri May 29, 2009 6:57 pm

Re: Integrating an Auto-Hide Application

Postby SynapseJumps » Sun Feb 14, 2016 10:44 pm

magreenblatt wrote:Red scrollbar usually means you're missing cef.pak


Winner! Wow. Boy was I over-complicating things. Glad I asked before I beat my head against the desk. Thanks, magreenblatt!
SynapseJumps
Newbie
 
Posts: 9
Joined: Mon May 11, 2015 5:36 pm


Return to Modifications Forum

Who is online

Users browsing this forum: No registered users and 1 guest