@@ -20,11 +20,13 @@ Func Main()
2020 #forceref $oMyError
2121
2222 ; Create the UI
23- Local $iHeight = 400
24- $hGUI = GUICreate (" WebView2 .NET Manager - Community Demo" , 800 , $iHeight )
25- $idLabelStatus = GUICtrlCreateLabel (" Status: Initializing Engine..." , 10 , $iHeight - 20 , 880 , 20 )
23+ Local $iHeight = 800
24+ $hGUI = GUICreate (" WebView2 .NET Manager - Community Demo" , 1100 , $iHeight )
25+ $idLabelStatus = GUICtrlCreateLabel (" Status: Initializing Engine..." , 10 , $iHeight - 20 , 880 , 20 )
2626 GUICtrlSetFont (- 1 , 9 , 400 , 0 , " Segoe UI" )
27- GUISetState (@SW_SHOW )
27+
28+ WinMove ($hGUI , ' ' , Default , Default , 800 , 440 )
29+ GUISetState (@SW_SHOW , $hGUI )
2830
2931 ; Initialize WebView2 Manager and register events
3032 Local $oWebV2M = _NetWebView2_CreateManager(" Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0" , " " , " --disable-gpu, --mute-audio" )
@@ -37,9 +39,29 @@ Func Main()
3739
3840 Local $sProfileDirectory = @TempDir & " \NetWebView2Lib-UserDataFolder"
3941 _NetWebView2_Initialize($oWebV2M , $hGUI , $sProfileDirectory , 0 , 0 , 0 , 0 , True , True , True , 1.2 , " 0x2B2B2B" )
42+ __NetWebView2_Log(@ScriptLineNumber , " After: _NetWebView2_Initialize()" , 1 )
4043
44+ ; navigate to HTML string - full fill the object with your own offline content - without downloading content
4145 _NetWebView2_NavigateToString($_g_oWeb , __GetDemoHTML())
4246
47+ MsgBox ($MB_TOPMOST , " TEST #" & @ScriptLineNumber , ' Watch Point' )
48+
49+ WinMove ($hGUI , ' ' , Default , Default , 1100 , 800 )
50+ GUISetState (@SW_HIDE , $hGUI )
51+
52+ ; navigate to a given URL - downloading online content
53+ _NetWebView2_Navigate($_g_oWeb , ' https://www.microsoft.com' , $NETWEBVIEW2_MESSAGE__TITLE_CHANGED , 5 * 1000 )
54+ GUISetState (@SW_SHOW , $hGUI )
55+
56+ MsgBox ($MB_TOPMOST , " TEST #" & @ScriptLineNumber , ' Watch Point' )
57+ ; navigate to fake/broken url
58+ ; ~ _NetWebView2_Navigate($oWebV2M, 'htpppps://www.microsoft.com', $NETWEBVIEW2_MESSAGE__COMPLETED)
59+
60+ MsgBox ($MB_TOPMOST , " TEST #" & @ScriptLineNumber , ' Watch Point' )
61+ ; navigate to fake/broken url
62+ ; ~ _NetWebView2_Navigate($oWebV2M, 'https://w2ww.microsoft.com', $NETWEBVIEW2_MESSAGE__COMPLETED, 100)
63+ ; ~ __NetWebView2_Log(@ScriptLineNumber, "After: https://w2ww.microsoft.com", 1)
64+
4365 ; Main Loop
4466 While 1
4567 Switch GUIGetMsg ()
@@ -76,7 +98,7 @@ Func _BridgeMyEventsHandler_OnMessageReceived($sMessage)
7698 Local Static $iMsgCnt = 0
7799
78100 If $sMessage = " CLOSE_APP" Then
79- If MsgBox (36 , " Confirm" , " Exit Application?" , 0 , $hGUI ) = 6 Then WinClose ( $hGUI )
101+ If MsgBox (36 , " Confirm" , " Exit Application?" , 0 , $hGUI ) = 6 Then Exit
80102 Else
81103 MsgBox (64 , " JS Notification" , " Message from Browser: " & $sMessage )
82104 $iMsgCnt += 1
@@ -103,4 +125,3 @@ Func __GetDemoHTML()
103125 ' </body></html>'
104126 Return $sH
105127EndFunc ; ==>__GetDemoHTML
106-
0 commit comments