Skip to content

Commit 9c5bba1

Browse files
authored
Update NetWebView2Lib.au3 $NETWEBVIEW2_ERR__*
1 parent 9857ff9 commit 9c5bba1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

NetWebView2Lib.au3

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
; Global objects
2727
Global $_g_bNetWebView2_DebugInfo = True
2828

29+
Global Enum _
30+
$NETWEBVIEW2_ERR__INIT_FAILED, _
31+
$NETWEBVIEW2_ERR__PROFILE_NOT_READY, _
32+
$NETWEBVIEW2_ERR___FAKE_COUNTER
33+
2934
Global Enum _ ; $NETWEBVIEW2_MESSAGE__* are set by __NetWebView2_Events__OnMessageReceived()
3035
$NETWEBVIEW2_MESSAGE__NONE, _ ; UDF setting - not related directly to API REFERENCES
3136
$NETWEBVIEW2_MESSAGE__INIT_FAILED, _
@@ -155,8 +160,13 @@ Func _NetWebView2_Initialize($oWebV2M, $hGUI, $s_ProfileDirectory, $i_Left = 0,
155160
Local $iInit = $oWebV2M.Initialize(($hGUI), $s_ProfileDirectory, $i_Left, $i_Top, $i_Width, $i_Height)
156161
If @error Then Return SetError(@error, @extended, $iInit)
157162

163+
Local $iMessage
158164
Do ; Wait for the engine to be ready before navigating
159165
Sleep(50)
166+
$iMessage = __NetWebView2_LastMessageReceived()
167+
If $iMessage = $NETWEBVIEW2_MESSAGE__INIT_FAILED Or $iMessage = $NETWEBVIEW2_MESSAGE__PROFILE_NOT_READY Then
168+
Return SetError($NETWEBVIEW2_ERR__INIT_FAILED, @extended, '')
169+
EndIf
160170
Until $b_LoadWait And $oWebV2M.IsReady
161171

162172
; WebView2 Configuration
@@ -1514,3 +1524,4 @@ Volatile Func __NetWebView2_Events__OnAcceleratorKeyPressed($oWebV2M, $hGUI, $oA
15141524
EndFunc ;==>__NetWebView2_Events__OnAcceleratorKeyPressed
15151525
#EndRegion ; NetWebView2Lib UDF - === EVENT HANDLERS ===
15161526

1527+

0 commit comments

Comments
 (0)