|
6 | 6 |
|
7 | 7 | ; 6-DownloadDemo.au3 |
8 | 8 |
|
| 9 | +Global $_sURLDownload_InProgress = '' |
9 | 10 | _Example() |
10 | 11 |
|
11 | 12 | Func _Example() |
@@ -80,23 +81,36 @@ 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) |
88 | 90 | $bProgres_State = 0 |
| 91 | + $_sURLDownload_InProgress = '' |
89 | 92 | Case "Completed" |
90 | 93 | ProgressSet(100, "Done", "Completed") |
91 | 94 | Sleep(3000) |
92 | 95 | $bProgres_State = 0 |
| 96 | + $_sURLDownload_InProgress = '' |
93 | 97 | EndSwitch |
94 | 98 | EndFunc ;==>__UserEventHandler__OnDownloadStateChanged |
95 | 99 |
|
96 | 100 | Func __UserEventHandler__OnAcceleratorKeyPressed($oWebV2M, $hGUI, $oArgs) |
97 | 101 | #forceref $oWebV2M |
98 | 102 |
|
99 | 103 | #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") |
| 104 | +;~ https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2acceleratorkeypressedeventargs?view=webview2-dotnet-1.0.705.50 |
| 105 | + ConsoleWrite($oArgs.Handled & @CRLF) ; Indicates whether the AcceleratorKeyPressed event is handled by host. |
| 106 | + ConsoleWrite($oArgs.KeyEventKind & @CRLF) ; Gets the key event kind that caused the event to run |
| 107 | + ConsoleWrite($oArgs.KeyEventLParam & @CRLF) ; Gets the LPARAM value that accompanied the window message. |
| 108 | +;~ 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 |
| 109 | + ConsoleWrite($oArgs.VirtualKey & @CRLF) ; Gets the Win32 virtual key code of the key that was pressed or released. |
| 110 | + |
| 111 | + If $oArgs.VirtualKey = 27 Then ; ESC 27 1b 033 Escape, next character is not echoed ; https://www.autoitscript.com/autoit3/docs/appendix/ascii.htm |
| 112 | + $oWebV2M.CancelDownloads($_sURLDownload_InProgress) |
| 113 | + EndIf |
100 | 114 |
|
101 | 115 | $hGUI = HWnd("0x" & Hex($hGUI, 16)) |
102 | 116 | Local Const $s_Prefix = "[USER:EVENT: OnAcceleratorKeyPressed]: GUI:" & $hGUI & " ARGS: " & ((IsObj($oArgs)) ? ('OBJECT') : ('ERRROR')) |
|
0 commit comments