Skip to content

Commit f064037

Browse files
authored
Update 006-DownloadDemo.au3
1 parent 8743d99 commit f064037

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

examples/006-DownloadDemo.au3

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
; 6-DownloadDemo.au3
88

9+
Global $_sURLDownload_InProgress = ''
910
_Example()
1011

1112
Func _Example()
@@ -80,23 +81,36 @@ Func __UserEventHandler__OnDownloadStateChanged($oWebV2M, $hGUI, $sState, $sURL,
8081
If $bProgres_State = 0 Then
8182
ProgressOn("Dowload in progress", StringRegExpReplace($sURL, '(.+/)(.+)', '$2'), $s_Message, -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE))
8283
EndIf
84+
$_sURLDownload_InProgress = $sURL
8385
ProgressSet(Round($iPercent), $s_Message)
8486
$bProgres_State = 1
8587
Case "Interrupted"
8688
ProgressSet(100, "Done", "Interrupted")
8789
Sleep(3000)
8890
$bProgres_State = 0
91+
$_sURLDownload_InProgress = ''
8992
Case "Completed"
9093
ProgressSet(100, "Done", "Completed")
9194
Sleep(3000)
9295
$bProgres_State = 0
96+
$_sURLDownload_InProgress = ''
9397
EndSwitch
9498
EndFunc ;==>__UserEventHandler__OnDownloadStateChanged
9599

96100
Func __UserEventHandler__OnAcceleratorKeyPressed($oWebV2M, $hGUI, $oArgs)
97101
#forceref $oWebV2M
98102

99103
#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
100114

101115
$hGUI = HWnd("0x" & Hex($hGUI, 16))
102116
Local Const $s_Prefix = "[USER:EVENT: OnAcceleratorKeyPressed]: GUI:" & $hGUI & " ARGS: " & ((IsObj($oArgs)) ? ('OBJECT') : ('ERRROR'))

0 commit comments

Comments
 (0)