|
26 | 26 | ; Global objects |
27 | 27 | Global $_g_bNetWebView2_DebugInfo = True |
28 | 28 |
|
| 29 | +Global Enum _ |
| 30 | + $NETWEBVIEW2_ERR__INIT_FAILED, _ |
| 31 | + $NETWEBVIEW2_ERR__PROFILE_NOT_READY, _ |
| 32 | + $NETWEBVIEW2_ERR___FAKE_COUNTER |
| 33 | + |
29 | 34 | Global Enum _ ; $NETWEBVIEW2_MESSAGE__* are set by __NetWebView2_Events__OnMessageReceived() |
30 | 35 | $NETWEBVIEW2_MESSAGE__NONE, _ ; UDF setting - not related directly to API REFERENCES |
31 | 36 | $NETWEBVIEW2_MESSAGE__INIT_FAILED, _ |
@@ -155,8 +160,13 @@ Func _NetWebView2_Initialize($oWebV2M, $hGUI, $s_ProfileDirectory, $i_Left = 0, |
155 | 160 | Local $iInit = $oWebV2M.Initialize(($hGUI), $s_ProfileDirectory, $i_Left, $i_Top, $i_Width, $i_Height) |
156 | 161 | If @error Then Return SetError(@error, @extended, $iInit) |
157 | 162 |
|
| 163 | + Local $iMessage |
158 | 164 | Do ; Wait for the engine to be ready before navigating |
159 | 165 | 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 |
160 | 170 | Until $b_LoadWait And $oWebV2M.IsReady |
161 | 171 |
|
162 | 172 | ; WebView2 Configuration |
@@ -1514,3 +1524,4 @@ Volatile Func __NetWebView2_Events__OnAcceleratorKeyPressed($oWebV2M, $hGUI, $oA |
1514 | 1524 | EndFunc ;==>__NetWebView2_Events__OnAcceleratorKeyPressed |
1515 | 1525 | #EndRegion ; NetWebView2Lib UDF - === EVENT HANDLERS === |
1516 | 1526 |
|
| 1527 | + |
0 commit comments