Skip to content

Commit 131952a

Browse files
Added initialization check for webview5
1 parent 4a013c0 commit 131952a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

specs/BrowserTaskManager.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ If the task manager is already opened, this method will do nothing.
2424
## C++: Open Task Manager
2525

2626
``` cpp
27-
wil::com_ptr<ICoreWebView2_5> m_webview;
27+
wil::com_ptr<ICoreWebView2> m_webview;
2828

2929
// This method could be called from a menu bar item, such as
3030
// [Script -> Open Task Manager Window].
3131
void ScriptComponent::OpenTaskManagerWindow()
3232
{
33-
CHECK_FAILURE(m_webview->OpenTaskManagerWindow());
33+
// Assume OpenTaskManagerWindow is available if we support ICoreWebView2_5.
34+
auto webview5 = m_webview.try_query<ICoreWebView2_5>();
35+
if (webview5)
36+
{
37+
CHECK_FAILURE(webview5->OpenTaskManagerWindow());
38+
}
3439
}
3540
```
3641

0 commit comments

Comments
 (0)