LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable / Enable mouse

Hello All

 

I wanted to disable and enable mouse programmatically in LabVIEW . Disabling is not only limited to that VI. Its complate disabling . The user cant even use mouse for any other application untill execution gets over. I think it can be acheived through calling a windows DLL (User32.dll may be not sure) . Pls share the code if anyone has already implemented the same or pls give me detailed info about which DLL needs to be called, what function can be used and what are the parameters and returns from DLL. Parameters are very important and i cant find anyinfo of parameters of any DLL from website. Pls help me.

 

Thanks in advance

Anoop

0 Kudos
Message 1 of 14
(7,869 Views)

I won't ask why you want to do this. The Windows API function BlockInput (in user32.dll) will do this, but it blocks both mouse and keyboard. This is also known as the "sledgehammer" approach.

Message 2 of 14
(7,860 Views)

Thanks for the response

 

I will explain you why I need it. In my application I am pasting (Paste Special option in activex control) diffrent language scripts other than English (Japanese,Korean etc) into an excel sheet. So i dont want to click anywhere while my application is running. Now coming to your response

 

I had seen that function before. But I dont know what are the parameters to pass in and what is the return type of that DLL.+ Could you pls help me out . Also is there no DLL to disable only mouse ?

0 Kudos
Message 3 of 14
(7,854 Views)

Hi Anoop,

BlockInput has an I32 input. You can see it in the provided link.

 

See also the functions "ClipCursor" and "ShowCursor", they should also help.

 

Mike

Message Edited by MikeS81 on 03-12-2009 03:26 PM
0 Kudos
Message 4 of 14
(7,847 Views)

I don't quite understand the specific application. Are you trying to paste something into Excel, or are you accessing an ActiveX control that's installed into Excel? If it's the former, I don't understand why you would need to block the mouse, as you can automate Excel directly using its ActiveX server.

 

As for the BlockInput, if you click on the link I provided it will tell you its input and return value. It has only one input, a BOOL, and it returns a BOOL. You can use an I32 for these. Do you know how to use the Call Library Function node?

 

I am not aware of a Windows API function that blocks only the mouse. There may be a third-party solution, but I have never had the need to investigate this. 

0 Kudos
Message 5 of 14
(7,838 Views)

System exec function in labview and this http://support.microsoft.com/kb/311272 may help. See also http://msdn.microsoft.com/en-us/library/ms792832.aspx

 

Message Edited by t06afre on 03-12-2009 03:51 PM


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 6 of 14
(7,831 Views)
I had actually considered suggesting devcon to basically disable the existing mouse, but disregarded it since I don't think that would prevent someone from simply plugging in another USB mouse.
0 Kudos
Message 7 of 14
(7,827 Views)
As I said earlier I have to paste different language scripts into an excel (Encoding enabled). Excel will not support dumping encoded script directly in to that. For that I simulate the key board CTR+C and and Paste special option (Activex). So generally while application is running if i click anywhere else (any other excel sheet cell,outlool mail or any selectable item) , that will be pasted in the excel sheet instead. So i wanted  to avoid the same. Thats why i wanted mouse to disable. Hope this clarifies
0 Kudos
Message 8 of 14
(7,791 Views)
Didn't test it, but after a simple search on this forum:

http://forums.ni.com/ni/board/message?board.id=330&message.id=12629&query.id=68069#M12629

Regards,

Wiebe.


0 Kudos
Message 9 of 14
(7,769 Views)

Would the following work?

 

It's supposed to be equivalent to selecting Edit->Paste Special, and then selecting "Unicode Text" in the dialog. 

Message Edited by smercurio_fc on 03-13-2009 09:16 AM
0 Kudos
Message 10 of 14
(7,745 Views)