Replies: 3 comments
-
Hey @waerxie - Do you have a stack or exception/hresult for the crash? Is "out.exe" the host app running the WebView2, or something else? If you don't run as admin, do you see the crash? Can you share a sample app which reproduces this issue? Thanks! |
Beta Was this translation helpful? Give feedback.
-
I modified my code: const HWND handleWnd = xxx;
HRESULT res = CreateCoreWebView2EnvironmentWithOptions(nullptr, nullptr, nullptr,
Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>(
[handleWnd](HRESULT result, ICoreWebView2Environment* env) -> HRESULT {
//..... this line can be call successfully
env->CreateCoreWebView2Controller(handleWnd, Callback<ICoreWebView2CreateCoreWebView2ControllerCompletedHandler>(
[handleWnd](HRESULT result, ICoreWebView2Controller* controller) -> HRESULT {
if (controller != nullptr) {
g_controller = controller;
g_controller->get_CoreWebView2(&g_webView);
}
// Add a few settings for the webview
// The demo step is redundant since the values are the default settings
ICoreWebView2Settings* Settings;
g_webView->get_Settings(&Settings);
Settings->put_IsScriptEnabled(TRUE);
Settings->put_AreDefaultScriptDialogsEnabled(TRUE);
Settings->put_IsWebMessageEnabled(TRUE);
// Resize WebView to fit the bounds of the parent window
RECT bounds;
GetClientRect(handleWnd, &bounds);
g_controller->put_Bounds(bounds);
HRESULT res = g_webView->Navigate(TEXT("file://d:\\temp\\1.html"));
return S_OK;
}).Get());
return S_OK;
}).Get()); Now "EBWebView" directory can be created both. |
Beta Was this translation helpful? Give feedback.
-
Do you have a stack trace for the crash? In the cases of failure, what it the HRESULT? I'm wondering if maybe it has an issue creating the user data folder ("EBWebView") directly under "D:". Can you try setting a different user data folder location (like "D:\temp" or "D:\123") and see if that resolves the issue when running the exe from "D:"? |
Beta Was this translation helpful? Give feedback.
-
When it crashed:
CreateCoreWebView2EnvironmentWithOptions function return S_OK;
HRESULT res = CreateCoreWebView2EnvironmentWithOptions(nullptr, TEXT("D:\temp"), nullptr, m_pController->GetHandler());
but env->CreateCoreWebView2Controller(handleWnd, m_pController->GetController()); this function crash.
When it workes, It will create directory EBWebView in d:\temp\.
When it crashes, EBWebView dit not create.
If the output file "out.exe", Copied to "d:\123\", It work well.
but if the output file "out.exe", Copied to "d:\", It crash.
out.ext is run as administorator.
How can i reslove it?
Beta Was this translation helpful? Give feedback.
All reactions