@@ -31,6 +31,9 @@ Global Enum _ ; $NETWEBVIEW2_MESSAGE__* are set by __NetWebView2_WebViewEvents__
3131 $NETWEBVIEW2_MESSAGE__INIT_READY , _
3232 $NETWEBVIEW2_MESSAGE__NAV_STARTING , _
3333 $NETWEBVIEW2_MESSAGE__URL_CHANGED , _
34+ $NETWEBVIEW2_MESSAGE__SOURCE_CHANGED , _ ; #TODO https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/wpf#step-7---navigation-events
35+ $NETWEBVIEW2_MESSAGE__CONTENT_LOADING , _ ; #TODO https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/wpf#step-7---navigation-events
36+ $NETWEBVIEW2_MESSAGE__HISTORY_CHANGED , _ ; #TODO https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/wpf#step-7---navigation-events
3437 $NETWEBVIEW2_MESSAGE__COMPLETED , _
3538 $NETWEBVIEW2_MESSAGE__TITLE_CHANGED , _
3639 $NETWEBVIEW2_MESSAGE__NAV_ERROR , _
@@ -88,7 +91,8 @@ Global Enum _ ; $NETWEBVIEW2_MESSAGE__* are set by __NetWebView2_WebViewEvents__
8891Func _NetWebView2_Initialize(ByRef $oWebV2M , $hGUI , $sProfileDirectory , $i_Left = 0 , $i_Top = 0 , $i_Width = 0 , $i_Height = 0 , $b_LoadWait = True , $b_SetAutoResize = True , $b_AreDevToolsEnabled = True , $i_ZoomFactor = 1.0 , $s_BackColor = " 0x2B2B2B" )
8992 Local Const $s_Prefix = " [_NetWebView2_Initialize]:" & " GUI:" & $hGUI & " ProfileDirectory:" & $sProfileDirectory & " LEFT:" & $i_Left & " TOP:" & $i_Top & " WIDTH" & $i_Width & " HEIGHT:" & $i_Height & " LOADWAIT:" & $b_LoadWait & " SETAUTORESIZE:" & $b_SetAutoResize & " SetAutoResize:" & $b_AreDevToolsEnabled & " ZoomFactor:" & $i_ZoomFactor & " BackColor:" & $s_BackColor
9093
91- ; Important: Pass $hGUI in parentheses to maintain Pointer type for COM
94+ ; ⚠️ Important: Enclose ($hGUI) in parentheses to force "Pass-by-Value".
95+ ; This prevents the COM layer from changing the AutoIt variable type from Ptr to Int64.
9296 Local $iInit = $oWebV2M .Initialize(($hGUI ), $sProfileDirectory , $i_Left , $i_Top , $i_Width , $i_Height )
9397 If @error Then Return SetError (@error , @extended , $iInit )
9498
@@ -299,11 +303,11 @@ EndFunc ;==>_NetWebView2_LoadWait
299303; #FUNCTION# ====================================================================================================================
300304; Name ..........: _NetWebView2_Navigate
301305; Description ...:
302- ; Syntax ........: _NetWebView2_Navigate(ByRef $oWebV2M, $sURL[, $iWaitMessage = $NETWEBVIEW2_MESSAGE__NAV_ERROR [,
306+ ; Syntax ........: _NetWebView2_Navigate(ByRef $oWebV2M, $sURL[, $iWaitMessage = $NETWEBVIEW2_MESSAGE__TITLE_CHANGED [,
303307; $iTimeOut_ms = 0]])
304308; Parameters ....: $oWebV2M - [in/out] an object.
305309; $sURL - a string value.
306- ; $iWaitMessage - [optional] an integer value. Default is $NETWEBVIEW2_MESSAGE__NAV_ERROR .
310+ ; $iWaitMessage - [optional] an integer value. Default is $NETWEBVIEW2_MESSAGE__TITLE_CHANGED .
307311; $iTimeOut_ms - [optional] an integer value. Default is 0.
308312; Return values .: None
309313; Author ........: mLipok, ioa747
@@ -313,7 +317,7 @@ EndFunc ;==>_NetWebView2_LoadWait
313317; Link ..........:
314318; Example .......: No
315319; ===============================================================================================================================
316- Func _NetWebView2_Navigate(ByRef $oWebV2M , $sURL , $iWaitMessage = $NETWEBVIEW2_MESSAGE__NAV_ERROR , $iTimeOut_ms = 0 )
320+ Func _NetWebView2_Navigate(ByRef $oWebV2M , $sURL , $iWaitMessage = $NETWEBVIEW2_MESSAGE__TITLE_CHANGED , $iTimeOut_ms = 0 )
317321 Local Const $s_Prefix = " [_NetWebView2_LoadWait]: URL:" & $sURL & " WAIT:" & $iWaitMessage
318322 Local $oMyError = ObjEvent (" AutoIt.Error" , __NetWebView2_COMErrFunc) ; Local COM Error Handler
319323 #forceref $oMyError
@@ -322,6 +326,7 @@ Func _NetWebView2_Navigate(ByRef $oWebV2M, $sURL, $iWaitMessage = $NETWEBVIEW2_M
322326 __NetWebView2_Log(@ScriptLineNumber , $s_Prefix , 1 )
323327 If @error Then Return SetError (@error , @extended , $iNavigation )
324328
329+ If $iWaitMessage = Default Then $iWaitMessage = $NETWEBVIEW2_MESSAGE__TITLE_CHANGED
325330 If $iWaitMessage Then _NetWebView2_LoadWait($oWebV2M , $iWaitMessage , $iTimeOut_ms )
326331 If @error Then __NetWebView2_Log(@ScriptLineNumber , $s_Prefix , 1 )
327332 Return SetError (@error , @extended , ' ' )
@@ -397,8 +402,6 @@ EndFunc ;==>_NetWebView2_NavigateToString
397402; ===============================================================================================================================
398403Func _NetWebView2_ExportPageData(ByRef $oWebV2M , $iFormat , $sFilePath = ' ' )
399404 #TODO $sParameters - search for = > " name" : " captureSnapshot" ; https://github.com/ChromeDevTools/devtools-protocol/blob/master/json/browser_protocol.json
400- #TODO https:// github.com/ ioa747/ NetWebView2Lib/ issues/ 15
401- #TODO https:// github.com/ ioa747/ NetWebView2Lib/ pull/ 16
402405
403406 Local Const $s_Prefix = " [_NetWebView2_ExportPageData]:" & " Format:" & $iFormat & " FilePath:" & (($sFilePath ) ? ($sFilePath ) : (' "EMPTY"' ))
404407 Local $oMyError = ObjEvent (" AutoIt.Error" , __NetWebView2_COMErrFunc) ; Local COM Error Handler
@@ -919,5 +922,3 @@ Func __NetWebView2_WebViewEvents__OnContextMenu($sMenuData)
919922 __NetWebView2_Log(@ScriptLineNumber , $s_Prefix , 1 )
920923EndFunc ; ==>__NetWebView2_WebViewEvents__OnContextMenu
921924#EndRegion ; NetWebView2Lib UDF - === EVENT HANDLERS ===
922-
923-
0 commit comments