You can block input from mouse and keyboard by calling the WinAPI function
BlockInput(bool). Just be sure to call the function from the same thread that runs the automation script, otherwise the automated clicks and keyboard events may also be blocked.
To use this method in C#, include the following definition in your class:
- Code: Select all
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern bool BlockInput(bool block);
Another problem with the BlockInput function is that it sometimes seems to block Ranorex.Element access and actions, too. That's why this functionality is not included in Ranorex by default. So, if your script blocks on a specific line, just enable the input before that line and disable it afterwards again.
Regards,
Alex
Ranorex Support Team