|
6 | 6 |
|
7 | 7 | ; 6-DownloadDemo.au3 |
8 | 8 |
|
| 9 | +Global $_sURLDownload_InProgress = '' |
9 | 10 | _Example() |
10 | 11 |
|
11 | 12 | Func _Example() |
@@ -80,25 +81,39 @@ Func __UserEventHandler__OnDownloadStateChanged($oWebV2M, $hGUI, $sState, $sURL, |
80 | 81 | If $bProgres_State = 0 Then |
81 | 82 | ProgressOn("Dowload in progress", StringRegExpReplace($sURL, '(.+/)(.+)', '$2'), $s_Message, -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) |
82 | 83 | EndIf |
| 84 | + $_sURLDownload_InProgress = $sURL |
83 | 85 | ProgressSet(Round($iPercent), $s_Message) |
84 | 86 | $bProgres_State = 1 |
85 | 87 | Case "Interrupted" |
86 | 88 | ProgressSet(100, "Done", "Interrupted") |
87 | 89 | Sleep(3000) |
| 90 | + ProgressOff() |
88 | 91 | $bProgres_State = 0 |
| 92 | + $_sURLDownload_InProgress = '' |
89 | 93 | Case "Completed" |
90 | 94 | ProgressSet(100, "Done", "Completed") |
91 | 95 | Sleep(3000) |
| 96 | + ProgressOff() |
92 | 97 | $bProgres_State = 0 |
| 98 | + $_sURLDownload_InProgress = '' |
93 | 99 | EndSwitch |
94 | 100 | EndFunc ;==>__UserEventHandler__OnDownloadStateChanged |
95 | 101 |
|
96 | 102 | Func __UserEventHandler__OnAcceleratorKeyPressed($oWebV2M, $hGUI, $oArgs) |
97 | | - #forceref $oWebV2M |
| 103 | + $hGUI = HWnd("0x" & Hex($hGUI, 16)) |
| 104 | + Local Const $sArgsList = '[Handled=' & $oArgs.Handled & '; KeyEventKind=' & $oArgs.KeyEventKind & '; KeyEventLParam=' & $oArgs.KeyEventLParam & '; VirtualKey=' & $oArgs.VirtualKey & ']' |
| 105 | + Local Const $s_Prefix = "[USER:EVENT: OnAcceleratorKeyPressed]: GUI:" & $hGUI & " ARGS: " & ((IsObj($oArgs)) ? ($sArgsList) : ('ERRROR')) |
98 | 106 |
|
99 | | - #TODO parse $oArgs to check if ESC KEY is pressed ==> $oWeb.CancelDownloads("https://fosszone.csd.auth.gr/tdf/libreoffice/stable/25.8.4/win/x86_64/LibreOffice_25.8.4_Win_x86-64.msi") |
| 107 | +;~ https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2acceleratorkeypressedeventargs?view=webview2-dotnet-1.0.705.50 |
| 108 | + ConsoleWrite($oArgs.Handled & @CRLF) ; Indicates whether the AcceleratorKeyPressed event is handled by host. |
| 109 | + ConsoleWrite($oArgs.KeyEventKind & @CRLF) ; Gets the key event kind that caused the event to run |
| 110 | + ConsoleWrite($oArgs.KeyEventLParam & @CRLF) ; Gets the LPARAM value that accompanied the window message. |
| 111 | +;~ ConsoleWrite('>> PhysicalKeyStatus=' & $oArgs.PhysicalKeyStatus & @CRLF) ; Gets a CoreWebView2PhysicalKeyStatus representing the information passed in the LPARAM of the window message. ==> ; https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2physicalkeystatus?view=webview2-dotnet-1.0.705.50 |
| 112 | + ConsoleWrite($oArgs.VirtualKey & @CRLF) ; Gets the Win32 virtual key code of the key that was pressed or released. |
| 113 | + |
| 114 | + If $oArgs.VirtualKey = 27 Then ; ESC 27 1b 033 Escape, next character is not echoed ; https://www.autoitscript.com/autoit3/docs/appendix/ascii.htm |
| 115 | + $oWebV2M.CancelDownloads($_sURLDownload_InProgress) |
| 116 | + EndIf |
100 | 117 |
|
101 | | - $hGUI = HWnd("0x" & Hex($hGUI, 16)) |
102 | | - Local Const $s_Prefix = "[USER:EVENT: OnAcceleratorKeyPressed]: GUI:" & $hGUI & " ARGS: " & ((IsObj($oArgs)) ? ('OBJECT') : ('ERRROR')) |
103 | 118 | __NetWebView2_Log(@ScriptLineNumber, (StringLen($s_Prefix) > 150 ? StringLeft($s_Prefix, 150) & "..." : $s_Prefix), 1) |
104 | 119 | EndFunc ;==>__UserEventHandler__OnAcceleratorKeyPressed |
0 commit comments