File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,19 +25,21 @@ public class MyWebView2Control
2525{
2626 ... // Regular control code
2727
28- // A previously created ICoreWebView2
29- IntPtr _myCoreWebView2ComObject = .. .;
30-
3128 CoreWebView2 _myCoreWebView2 = null ;
3229
30+ [DllImport (DLL_NAME , CallingConvention = CallingConvention .StdCall )]
31+ public static extern ComNativePointer GetNativePointer (WebViewInstancePtr instanceId );
32+
3333 // This is the CoreWebView2 property which allows developers to access CoreWebView2 APIs directly.
3434 public CoreWebView2 CoreWebView2
3535 {
3636 get
3737 {
3838 if (! _myCoreWebView2 )
3939 {
40- _myCoreWebView2 = CoreWebView2 .CreateFromComObject (_myCoreWebView2Object );
40+ IntPtr comPtr = WebViewNative .GetNativePointer (InstanceId );
41+
42+ _myCoreWebView2 = CoreWebView2 .CreateFromComObject (comPtr );
4143 }
4244 return _myCoreWebView2 ;
4345 }
You can’t perform that action at this time.
0 commit comments