hwnd check before use

This commit is contained in:
Hassan DRAGA 2025-03-15 23:11:21 -04:00
parent 361237669b
commit 25c7e3f16c

View File

@ -11351,13 +11351,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
NULL, NULL, GetModuleHandle(NULL), NULL
);
{ // window size correction
RECT rc;
GetClientRect(win->webView->hwnd, &rc);
win->webView->width = rc.right - rc.left;
win->webView->height = rc.bottom - rc.top;
}
if (!win->webView->hwnd) {
_webui_wv_free(win->webView);
win->webView = NULL;
@ -11365,6 +11358,12 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
WEBUI_THREAD_RETURN
}
// window size correction
RECT rc;
GetClientRect(win->webView->hwnd, &rc);
win->webView->width = rc.right - rc.left;
win->webView->height = rc.bottom - rc.top;
SetWindowLongPtr(win->webView->hwnd, GWLP_USERDATA, (LONG_PTR)win);
ShowWindow(win->webView->hwnd, SW_SHOW);
static CreateCoreWebView2EnvironmentWithOptionsFunc createEnv = NULL;