c++awesomium

How to hide Close,Minimize and Maximize buttons and the surrounding edges in awesomium application?


Is it possible to hide the native close,maximize and minimize button and the surrounding edges of the window that holdes an awesomium application..

enter image description here

I am looking for a way to design nice close,maximize and minimize button within the html document will do the function of the native buttons to be hidden.

here are my c++ codes

// Inherited from Application::Listener
  virtual void OnLoaded() {
    view_ = View::Create(500, 300);

    WebURL url(WSLit("file:///C:/Users/awesomium/Documents/app.html"));
    view_->web_view()->LoadURL(url);
  }

contents of my html file is below

<html>
<body>
<h1>Hello World</h1>
<script type="text/javascript">
document.write("You are running Awesomium " + awesomium.version);
</script>
</body>
</html>

Note: I am pretty new to awesomium and c++ (in a sense)..making this simple will be great!.


Solution

  • You control the traits of the created Windows window by setting the dwStyle property in the call to CreateWindow.

    I used the Awesomium Tutorial 2 (http://wiki.awesomium.com/tutorials/tutorial-2-displaying-your-first-page.html)

    Locate the ViewWin(int width, int height) constructor and edit the call to the CreateWindow. The following example creates a window with no borders nor a caption.

    hwnd_ = CreateWindow(
              szWindowClass,
              szTitle,
              WS_POPUP | WS_VISIBLE | WS_SYSMENU,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              width + 20,
              height + 40, 
              NULL,
              NULL,
              hInstance,
              NULL);
    

    When I tried it I got a problem with the WndProc being called pre-maturely (the view-pointer still NULL) so I added a quick fix to make the application run.

    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
    
    ...
    
    case WM_SIZE:
      if (view == NULL) return 0; // Quick fix to not call view until it is fully initialized
      view->web_view()->Resize(LOWORD(lParam), HIWORD(lParam));
    break;
    
    ...
    

    This may not be the way to go and you can probably figure something better out? The created window looks like the following:

    Awesomium "Hello World" with no caption nor borders

    I hope this will get you on track to get your application to work as you like it to?