From 9c5bba1002ef5b4b971eb7ff8cd8ebe2c3e9c335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Wed, 11 Feb 2026 09:35:54 +0100 Subject: [PATCH 1/4] Update NetWebView2Lib.au3 $NETWEBVIEW2_ERR__* --- NetWebView2Lib.au3 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NetWebView2Lib.au3 b/NetWebView2Lib.au3 index d857633..d31db47 100644 --- a/NetWebView2Lib.au3 +++ b/NetWebView2Lib.au3 @@ -26,6 +26,11 @@ ; Global objects Global $_g_bNetWebView2_DebugInfo = True +Global Enum _ + $NETWEBVIEW2_ERR__INIT_FAILED, _ + $NETWEBVIEW2_ERR__PROFILE_NOT_READY, _ + $NETWEBVIEW2_ERR___FAKE_COUNTER + Global Enum _ ; $NETWEBVIEW2_MESSAGE__* are set by __NetWebView2_Events__OnMessageReceived() $NETWEBVIEW2_MESSAGE__NONE, _ ; UDF setting - not related directly to API REFERENCES $NETWEBVIEW2_MESSAGE__INIT_FAILED, _ @@ -155,8 +160,13 @@ Func _NetWebView2_Initialize($oWebV2M, $hGUI, $s_ProfileDirectory, $i_Left = 0, Local $iInit = $oWebV2M.Initialize(($hGUI), $s_ProfileDirectory, $i_Left, $i_Top, $i_Width, $i_Height) If @error Then Return SetError(@error, @extended, $iInit) + Local $iMessage Do ; Wait for the engine to be ready before navigating Sleep(50) + $iMessage = __NetWebView2_LastMessageReceived() + If $iMessage = $NETWEBVIEW2_MESSAGE__INIT_FAILED Or $iMessage = $NETWEBVIEW2_MESSAGE__PROFILE_NOT_READY Then + Return SetError($NETWEBVIEW2_ERR__INIT_FAILED, @extended, '') + EndIf Until $b_LoadWait And $oWebV2M.IsReady ; WebView2 Configuration @@ -1514,3 +1524,4 @@ Volatile Func __NetWebView2_Events__OnAcceleratorKeyPressed($oWebV2M, $hGUI, $oA EndFunc ;==>__NetWebView2_Events__OnAcceleratorKeyPressed #EndRegion ; NetWebView2Lib UDF - === EVENT HANDLERS === + From 8533917e322f20f3a9f9fefc340ee94e78e65fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Wed, 11 Feb 2026 09:45:32 +0100 Subject: [PATCH 2/4] Update NetWebView2Lib.au3 --- NetWebView2Lib.au3 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NetWebView2Lib.au3 b/NetWebView2Lib.au3 index d31db47..9ac6842 100644 --- a/NetWebView2Lib.au3 +++ b/NetWebView2Lib.au3 @@ -1140,9 +1140,8 @@ Volatile Func __NetWebView2_Events__OnMessageReceived($oWebV2M, $hGUI, $sMsg) Local $aParts Local Static $sCommand_static = '' - - If Not @Compiled And $sCommand_static <> $sCommand Then -;~ ConsoleWrite('TEST IFNC: ' & $s_Prefix & ' @SLN=' & @ScriptLineNumber & ' ' & $sCommand & ' Data=' & (StringLen($sData) > 120 ? StringLeft($sData, 120) & "..." : $sData) & @CRLF) ; FOR DEV TESTING ONLY + If Not @Compiled And $sCommand_static <> $sCommand Then ; show the log in non compiled - for DEV only + ConsoleWrite('TEST IFNC: ' & $s_Prefix & ' @SLN=' & @ScriptLineNumber & ' ' & $sCommand & ' Data=' & (StringLen($sData) > 120 ? StringLeft($sData, 120) & "..." : $sData) & @CRLF) ; FOR DEV TESTING ONLY $sCommand_static = $sCommand EndIf @@ -1525,3 +1524,4 @@ EndFunc ;==>__NetWebView2_Events__OnAcceleratorKeyPressed #EndRegion ; NetWebView2Lib UDF - === EVENT HANDLERS === + From 90ebca9d750d8b8bf02442aa6b094704108a3ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Wed, 11 Feb 2026 09:56:08 +0100 Subject: [PATCH 3/4] Update NetWebView2Lib.au3 --- NetWebView2Lib.au3 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NetWebView2Lib.au3 b/NetWebView2Lib.au3 index 9ac6842..4aebb47 100644 --- a/NetWebView2Lib.au3 +++ b/NetWebView2Lib.au3 @@ -1134,7 +1134,8 @@ Volatile Func __NetWebView2_Events__OnMessageReceived($oWebV2M, $hGUI, $sMsg) $hGUI = HWnd("0x" & Hex($hGUI, 16)) Local Const $s_Prefix = "[NetWebView2Lib:EVENT: OnMessageReceived]: GUI:" & $hGUI - Local $iSplitPos = StringInStr($sMsg, "|") + #Region ; Message parsing + Local $iSplitPos = StringSplit($sMsg, "|") Local $sCommand = $iSplitPos ? StringStripWS(StringLeft($sMsg, $iSplitPos - 1), 3) : $sMsg Local $sData = $iSplitPos ? StringTrimLeft($sMsg, $iSplitPos) : "" Local $aParts @@ -1144,6 +1145,7 @@ Volatile Func __NetWebView2_Events__OnMessageReceived($oWebV2M, $hGUI, $sMsg) ConsoleWrite('TEST IFNC: ' & $s_Prefix & ' @SLN=' & @ScriptLineNumber & ' ' & $sCommand & ' Data=' & (StringLen($sData) > 120 ? StringLeft($sData, 120) & "..." : $sData) & @CRLF) ; FOR DEV TESTING ONLY $sCommand_static = $sCommand EndIf + #EndRegion ; Message parsing Switch $sCommand Case "WINDOW_RESIZED" @@ -1525,3 +1527,4 @@ EndFunc ;==>__NetWebView2_Events__OnAcceleratorKeyPressed + From 114c82861ef74c406a589461f977dcb72c5257e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Wed, 11 Feb 2026 10:05:59 +0100 Subject: [PATCH 4/4] Update NetWebView2Lib.au3 --- NetWebView2Lib.au3 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NetWebView2Lib.au3 b/NetWebView2Lib.au3 index 4aebb47..79e5bcc 100644 --- a/NetWebView2Lib.au3 +++ b/NetWebView2Lib.au3 @@ -163,7 +163,7 @@ Func _NetWebView2_Initialize($oWebV2M, $hGUI, $s_ProfileDirectory, $i_Left = 0, Local $iMessage Do ; Wait for the engine to be ready before navigating Sleep(50) - $iMessage = __NetWebView2_LastMessageReceived() + $iMessage = __NetWebView2_LastMessageReceived($oWebV2M) If $iMessage = $NETWEBVIEW2_MESSAGE__INIT_FAILED Or $iMessage = $NETWEBVIEW2_MESSAGE__PROFILE_NOT_READY Then Return SetError($NETWEBVIEW2_ERR__INIT_FAILED, @extended, '') EndIf @@ -1292,7 +1292,7 @@ Volatile Func __NetWebView2_Events__OnMessageReceived($oWebV2M, $hGUI, $sMsg) ;~ __NetWebView2_LastMessageReceived($oWebV2M, $NETWEBVIEW2_MESSAGE__*) Case Else - __NetWebView2_Log(@ScriptLineNumber, $s_Prefix & (StringLen($sMsg) > 150 ? StringLeft($sMsg, 150) & "..." : $sMsg), 1) + __NetWebView2_Log(@ScriptLineNumber, $s_Prefix & " " & (StringLen($sMsg) > 150 ? StringLeft($sMsg, 150) & "..." : $sMsg), 1) EndSwitch EndFunc ;==>__NetWebView2_Events__OnMessageReceived @@ -1528,3 +1528,4 @@ EndFunc ;==>__NetWebView2_Events__OnAcceleratorKeyPressed +