Ranorex

Disable/enable the mouse and keyboard - is it possible?

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
testMunky



Joined: 16 Jan 2008
Posts: 6
Location: Hants, UK

PostPosted: Wed Jan 16, 2008 12:57 pm    Post subject: Disable/enable the mouse and keyboard - is it possible?
Hello,

I've done a search and can't find the info so thought i'd post here Smile

Is it possible to disable the keyboard and/or mouse for the duration of the script?

Thanks


Si Twisted Evil
Back to top
View user's profile Send private message Visit poster's website
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 257

PostPosted: Wed Jan 16, 2008 6:42 pm    Post subject:
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: click into code to enlarge
[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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum