Webview2 (c++) - ICoreWebView2Controller2 unable to access

Viewed 16

I'm trying to get access to the ICoreWebView2Controller2 from webview2 ICoreWebView2Controller - literally running this sample win32 code (VS2022 community edition) https://github.com/MicrosoftEdge/WebView2Browser - with only addition of snippet below..

wil::com_ptr<ICoreWebView2Controller2> controller2 = m_controlsController.query<ICoreWebView2Controller2>();

however getting compile error on query

any help appreciated

thanks Kerrigan.

enter image description here

1 Answers

ugh, I had the type wrongly defined, I had it as this

Microsoft::WRL::ComPtr<ICoreWebView2Controller> m_controlsController;

while it should have been

wil::com_ptr<ICoreWebView2Controller>
Related