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