Using Blockinput with WScript or .NET
1 view (last 30 days)
Show older comments
Hey guys,
as I am accessing a programm which does not support ActiveX I need to do it with Windows Script. I want to block user input during the time the script is running.
In the microsoft documents there is a function called Blockinput. (See here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms646290%28v=vs.85%29.aspx)
How can I access this function properly with Matlab?
Thanks for your help, I try this for almost a year and I need help now!
0 Comments
Answers (2)
Guillaume
on 27 Aug 2015
BlockInput is a win32 api function. You can neither access it with ActiveX nor windows script. You would either have to wrap the call in a mex file, or figure out how to generate a proto file to use loadlibrary to load user32.dll (where BlockInput resides).
However, if I came across a program that blocked all user inputs, I'd uninstall it in a heartbeat. This is not good user interface design. Preventing the user from doing what they want is never a good idea. There is no reason why you'd need to block all user input from matlab.
In any case, it sounds like blocking user input is just a workaround for another problem you're having. If that is the case, then ask for help solving that other problem rather than help implementing an ugly workaround.
0 Comments
A J BAnks
on 27 Aug 2015
1 Comment
Guillaume
on 27 Aug 2015
Please use the comment on this answer box instead of the answer this question box.
So is your question about calling a windows script? or about blocking user input? And what is that strange windows script that fails if the user presses a key or move the mouse?
"load library won't work here for reasons I can't properly understand". Well, unless you tell us more, we certainly won't understand the reason either.
If I really wanted to block user input for a few seconds, I'd simply write a simple command line program in C or C#, compile into an executable, and invoke said executable from matlab. The program would just consist of a call to BlockInput and a timer that terminates the program after x seconds.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!