window* window::create( int x, int y, int width, int height, const wchar_t* caption ) 
  {
    window* pw = new window();

    UINT style = WS_POPUP | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX;
    pw->hwnd = CreateWindowExW( WS_EX_LAYERED, CLASSNAME, NULL, style ,
                                x, y, width, height, NULL, NULL, hinstance, NULL);
//    pw->hwnd = CreateWindowExW( 0, CLASSNAME, NULL, style ,
//                                x, y, width, height, NULL, NULL, hinstance, NULL);
    self(pw->hwnd,pw);
    HTMLayoutSetCallback(pw->hwnd,&callback,pw);
    PBYTE pb; DWORD cb;
    if(load_resource_data(L"DEFAULT",pb,cb))
    {
      HTMLayoutLoadHtml(pw->hwnd,pb,cb);

      dom::element r = pw->root();

      pw->body            = r.find_first("body");
      pw->caption         = r.get_element_by_id("caption");
      pw->button_min      = r.get_element_by_id("minimize");
      pw->button_max      = r.get_element_by_id("maximize");
      pw->button_icon     = r.get_element_by_id("icon");
      pw->button_close    = r.get_element_by_id("close");
      pw->corner          = r.get_element_by_id("corner");

      attach_event_handler(pw->hwnd, pw);

      pw->set_caption(caption);

    }
    return pw;
  }
Exemple #2
0
static
void
store_resource_to_file(LPCWSTR name, LPCWSTR type,
                       std::string path) {
  auto data = load_resource_data(name, type);
  write_file(path, data.get_data(), data.get_size());  
}