O AHK não pode interceptar esses atalhos do Windows.
Se você não quiser editar os valores do registro, não acho que haja uma maneira de fazer isso. O valor do registro é HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System: DisableLockWorkstation
, o que se 1 não permitir o bloqueio total do sistema, com ou sem atalho, e com 0 bloqueio for permitido e atalho Win + L bloqueará o sistema independentemente do que tentar interceptá-lo. Comentou (para quem procura um código de solução Win + L, mas não conheça AHK):
Com a edição do registro:
; WARNING: Programs that use User32\LockWorkStation (i.e. programmatically locking the operating system) may not work correctly!
; This includes Windows itself (i.e. using start menu or task manager to lock will also not work).
; Script changes Win-L to show a msgbox and Ctrl-Alt-L to lock windows
; The following 3 code lines are auto-executed upon script run, the return line marks an end to the auto-executed code section.
; Register user defined subroutine 'OnExitSub' to be executed when this script is terminating
OnExit, OnExitSub
; Disable LockWorkStation, so Windows doesn't intercept Win+L and this script can act on that key combination
SetDisableLockWorkstationRegKeyValue( 1 )
return
#l::
MsgBox, Win-L was pressed! ; Arbitrary code here
return
^!l::
; Ctrl-Alt-L
; Temporary enable locking
SetDisableLockWorkstationRegKeyValue( 0 )
; Lock
DllCall( "User32\LockWorkStation" )
; Disable locking again
SetDisableLockWorkstationRegKeyValue( 1 )
return
OnExitSub:
; Enable LockWorkStation, because this script is ending (so other applications aren't further disturbed)
SetDisableLockWorkstationRegKeyValue( 0 )
ExitApp
return
SetDisableLockWorkstationRegKeyValue( value )
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableLockWorkstation, %value%
}