import user32.dll and use the 'BlockInput' function in it

10 ビュー (過去 30 日間)
Krishna
Krishna 2011 年 6 月 8 日
コメント済み: Vishnu 2015 年 1 月 25 日
Hi,
I am sending a series of keystrokes to the notepad application from Matlab and through the total process I would like to lock the user input form both keyboard and mouse till the process completes and then release the lock. I found that there is a function called 'BlockInput' MSDN function in 'user32.dll'. So I am trying to import this dll into Matlab and use the function but I am getting the following error when I am trying to load the dll using 'loadlibrary' command.
loadlibrary('"C:\WINDOWS\system32\user32.dll"','winuser'); Warning: The library class 'user32' already exists. Use a classname alias.
Any guidance is appreciated.
Thanks, Krishna.
  1 件のコメント
Kaustubha Govind
Kaustubha Govind 2011 年 6 月 8 日
What do you see when type:
libisloaded user32

サインインしてコメントする。

採用された回答

Krishna
Krishna 2012 年 2 月 3 日
I created a dll in VB dotnet for the required function 'BlockInput'. I registered the created dll in Matlab using RegAsm.exe . Once I registered the dll in Matlab I created a COM component using 'actxserver' command. Then I could use the methods in the COM component and I got it working :) .

その他の回答 (5 件)

Krishna
Krishna 2011 年 6 月 10 日
Sorry about repeating the question.. I am getting 0.. I guess this means the library is not loaded..

Kaustubha Govind
Kaustubha Govind 2011 年 6 月 10 日
Try:
addpath('C:\WINDOWS\system32\')
loadlibrary user32 winuser.h
If you continue to see the same error, try:
loadlibrary user32 winuser.h alias user32lib
  1 件のコメント
Vishnu
Vishnu 2015 年 1 月 25 日
Matlab removed my previous post, here is my new post with source code..
And to my knowledge the loadlibrary method I followed is undocumented...

サインインしてコメントする。


UT
UT 2012 年 2 月 3 日
Hi Krishna,
Did you find out what was the problem?
  1 件のコメント
Krishna
Krishna 2012 年 2 月 3 日
I have my solution here. Let me know if you need more info.

サインインしてコメントする。


Ignacio
Ignacio 2014 年 10 月 23 日
Hi Krishna, I would like to disable temporality my keyboard and mouse through Matlab and I would like to know how did you do that.
Could you please post your solution or somehow send it to me?
Thanks!

Vishnu
Vishnu 2015 年 1 月 21 日

カテゴリ

Help Center および File ExchangeCOM Component Integration についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by