c++ - Awesomium WebView doesn't display page -


i've made 2 simple classes use displaying uis awesomium. creating awesomium webview , setting parent window win32 window causes program hang , page never displayed. classes simple , creating window simple there isn't can think of going wrong. perhaps there else required i've done display webview?

to clarify: creating win32 window without creating webview works fine, window functions including drag code etc... hang happens when call set_parent_window.

ui.h

#pragma once #include <windows.h> #include <windowsx.h> #include <awesomium/webcore.h> #include <awesomium/stlhelpers.h>  using namespace awesomium;  lresult callback loginuicallback(hwnd hwnd, uint message, wparam wparam, lparam lparam);  class ui { public:     //window variables     hinstance instance;     hwnd window;     bool drag_window = false;     short mouse_x, mouse_y, mouse_x_prev, mouse_y_prev;      //awesomium variables     webcore* webcore = 0;     webview* webview;      static hwnd initwindow(int width, int height, wndproc callback)     {         hwnd hwnd;          wndclassex wc;         wc.cbsize = sizeof(wndclassex);         wc.style = 0;         wc.lpfnwndproc = callback;         wc.cbclsextra = 0;         wc.cbwndextra = 0;         wc.hinstance = getmodulehandle(0);         wc.hicon = loadicon(null, idi_application);         wc.hcursor = loadcursor(null, idc_arrow);         wc.hbrbackground = (hbrush)(color_window + 1);         wc.lpszmenuname = null;         wc.lpszclassname = "myui";         wc.hiconsm = loadicon(null, idi_application);          if (!registerclassex(&wc))         {             char msg[100];             sprintf(msg, "system error: %i", getlasterror());             messagebox(null, msg, "error", mb_ok);             return null;         }          hwnd = createwindow("myui",             "",             ws_popup,             cw_usedefault,             cw_usedefault,             width,             height,             null,             null,             getmodulehandle(0),             null);          if (!hwnd)         {             char msg[100];             sprintf(msg, "system error: %i", getlasterror());             messagebox(null, msg, "error", mb_ok);             return null;         }           showwindow(hwnd, sw_shownormal);         updatewindow(hwnd);         settimer(hwnd, 0, 15, null);          return hwnd;     } };  class loginui : public ui { public:     int width = 600;     int height = 600;      int runui()     {         this->window = ui::initwindow(this->width, this->height, ::loginuicallback);          if (!this->window)             return 0;          webconfig config;         this->webcore = webcore::initialize(config);         this->webview = this->webcore->instance()->createwebview(this->width, this->height, 0, kwebviewtype_window);         this->webview->set_parent_window(this->window);         this->webview->loadurl(weburl(wslit("http://www.google.com")));          msg msg;         while(getmessage(&msg, this->window, 0, 0))         {             translatemessage(&msg);             dispatchmessage(&msg);         }          webcore::shutdown();          return 1;     } }login_ui;  lresult callback loginuicallback(hwnd hwnd, uint message, wparam wparam, lparam lparam) {     switch (message)     {         case wm_command:             return defwindowproc(hwnd, message, wparam, lparam);             break;         case wm_timer:             break;         case wm_mousemove:         {             if (login_ui.drag_window && (wparam & mk_lbutton))             {                 // code executed when dialog window moved around on screen                 rect win_rect;                 getwindowrect(hwnd, &win_rect);                 int x_coord = get_x_lparam(lparam);                 int y_coord = get_y_lparam(lparam);                 movewindow(hwnd,                     win_rect.left + x_coord - login_ui.mouse_x_prev,                     win_rect.top + y_coord - login_ui.mouse_y_prev,                     win_rect.right - win_rect.left,                     win_rect.bottom - win_rect.top,                     false                     );             }             break;         }         case wm_lbuttondown:         {             login_ui.mouse_x = get_x_lparam(lparam);             login_ui.mouse_y = get_y_lparam(lparam);             if (login_ui.mouse_y < 41)             {                 login_ui.mouse_x_prev = login_ui.mouse_x;                 login_ui.mouse_y_prev = login_ui.mouse_y;                 setcapture(hwnd);                 login_ui.drag_window = true;             }             break;         }         case wm_lbuttonup:         {             if (login_ui.drag_window)             {                 login_ui.drag_window = false;                 releasecapture();             }             break;         }         case wm_size:             break;         case wm_destroy:             postquitmessage(0);             break;         case wm_quit:             break;         default:             return defwindowproc(hwnd, message, wparam, lparam);     }     return 0; } 

main.cpp

#include "ui.h"  int apientry winmain(hinstance hinstance, hinstance, char*, int ncmdshow) {     login_ui.runui(); } 

have not used awesomium getmessage pumps messages webcore window. instead should pass null message pump dispatches messages windows created on thread.


Comments

Popular posts from this blog

Google sheets equipment borrowing system -

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

c# - Convert type 'System.Collections.Generic.List<string>' to 'System.Collections.Generic.IList<>' -