0

I am using webview.h and trying to create a webview as a child to my application.

This is the webview_create function:

WEBVIEW_API webview_t webview_create(int debug, void *wnd) {
   return new webview::webview(debug, wnd);
}

They are describing my problem in this issue:

https://github.com/webview/webview/issues/386

When I try to create the webview, it either crashes my application immediately, or resizes my entire application and crashes soon after (but loads the website).

In the GitHub issue, the problem was resolved by passing a pointer to the HWND variable

What I tried:

HWND parent = self.get_element_hwnd(false);
webview::webview w(false, parent);


HWND parent = self.get_element_hwnd(false);
webview::webview w(false, &parent);


HWND parent = self.get_element_hwnd(false);
HWND *pp = &parent;
webview::webview w(false, pp);


HWND parent = self.get_element_hwnd(false);
HWND *pp = &parent;
webview::webview w(false, &pp);

I thought passing the HWND like &parent should work, but it doesn't. Basically, I am guessing at this point. Would appreciate any help.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
Dawg
  • 69
  • 9
  • 1
    What is `self` here? I understand this is some kind of sciter thing but if you look at the window handle you are getting back, in Spy++ say or just by inspecting it with various Win32 calls, is `get_element_hwnd` giving you the window handle you expect? – jwezorek Sep 10 '21 at 15:22
  • `self` is `sciter::dom::element` here is the doc of the `get_element_hwnd` https://sciter.com/sdk/doc.api/html/classsciter_1_1dom_1_1element.html#ab7eb72a021c4b8bc3a21f40efb20f6b2 it basically calls `inline SCDOM_RESULT SCAPI SciterGetElementHwnd(HELEMENT he, HWINDOW* p_hwnd, BOOL rootWindow) { return SAPI()->SciterGetElementHwnd(he,p_hwnd,rootWindow); }` Not quite sure on what to expect as a window handle. Oddly enough, when I call the webview.run() function, the webview works but it 'takes over' my application in fullscreen. https://github.com/webview/webview/blob/master/webview.h#L1141 – Dawg Sep 10 '21 at 15:47
  • It seems like the webview class is ignoring the window handle you pass it. Either you are getting a bad window handle back from sciter or that webview class has a bug in it. I don't know which but the webview code does not instill me with a lot of confidence. What platforms do you need to support? You could just use one of Microsoft's native web views if you only care about windows or you could use CEF otherwise. – jwezorek Sep 10 '21 at 16:13
  • Have you tried to make `pp` pointer non local (eg biltin into structure/object or global)? – Daniel Sęk Sep 11 '21 at 09:48
  • I tried that @DanielSęk it yelds the same result. – Dawg Sep 11 '21 at 10:45

0 Answers0