File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -25,19 +25,21 @@ public class MyWebView2Control
25
25
{
26
26
... // Regular control code
27
27
28
- // A previously created ICoreWebView2
29
- IntPtr _myCoreWebView2ComObject = .. .;
30
-
31
28
CoreWebView2 _myCoreWebView2 = null ;
32
29
30
+ [DllImport (DLL_NAME , CallingConvention = CallingConvention .StdCall )]
31
+ public static extern ComNativePointer GetNativePointer (WebViewInstancePtr instanceId );
32
+
33
33
// This is the CoreWebView2 property which allows developers to access CoreWebView2 APIs directly.
34
34
public CoreWebView2 CoreWebView2
35
35
{
36
36
get
37
37
{
38
38
if (! _myCoreWebView2 )
39
39
{
40
- _myCoreWebView2 = CoreWebView2 .CreateFromComObject (_myCoreWebView2Object );
40
+ IntPtr comPtr = WebViewNative .GetNativePointer (InstanceId );
41
+
42
+ _myCoreWebView2 = CoreWebView2 .CreateFromComObject (comPtr );
41
43
}
42
44
return _myCoreWebView2 ;
43
45
}
You can’t perform that action at this time.
0 commit comments