Method Reference (COM)

BlockInput

Disable/enable the mouse and keyboard.

BlockInput flag

 

Parameters

flag 1 = Disable user input
0 = Enable user input

 

Return Value

None.

 

Remarks

If BlockInput is enabled, the Alt keypress cannot be sent!
The table below shows how BlockInput behavior depends on Windows' version; however, pressing Ctrl+Alt+Del on any platform will re-enable input due to a Windows API feature.

Operating System "BlockInput" Results
Windows 95 No effect.
Windows 98/Me User input is blocked but AutoIt is also unable to simulate input.
Windows NT 4 (Without ServicePack 6) No effect.
Windows NT 4 (With ServicePack 6) User input is blocked and AutoIt can simulate most input.
Windows 2000/XP User input is blocked and AutoIt can simulate most input.

Note that functions such as WinMove() will still work on Windows 98/Me when BlockInput is enabled.

 

Related

Send

 

Example

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

oAutoIt.BlockInput 1

oAutoIt.Run "notepad.exe"
oAutoIt.WinWaitActive "Untitled - Notepad"
oAutoIt.Send "{F5}"

oAutoIt.BlockInput 0