LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

lock mouse cursor on FP

Hello All

Does anybody know if it is possible to lock the mouse cursor (the arrow) at a particular position on the FP, when a vi is running, and release it after the vi stops for normal operation, and still be able to use mouse up/down events

 

The "lock" location is not specific to a graph, indicator or control. In simpler terms...when the vi starts (position of mouse arrow is not critical ), the mouse cursor cannot be repositioned on the FP...no matter how much mouse scrolling the user tries.

 

I am already using the mouse down/up events with "panel"...so no suggestions about using this please.

 

The procedure might look like this

 

1. Vi starts

2. mouse arrow is locked into position (wherever it is)

3. Vi function performs

4. Vi stops and releases mouse for windoze use.

 

 

Regards

Ray

0 Kudos
Message 1 of 5
(3,257 Views)

I don't think there would be any way you could do that.  The cursor is controlled by Windows, and I really don't think Windows is going to let an application take that kind of control of a cursor.  It is just too dangerous.  If the application never relinquishes control, then Windows will be effectively locked up with no easy way to get control back again from the renegade application.

Message 2 of 5
(3,252 Views)

Thanks Ravens Fan

I suspected as much, but doesn't hurt to put it out there. You never know.....somebody may have done it at some time.

Regards

Ray

0 Kudos
Message 3 of 5
(3,214 Views)

You could probably use the WINAPI functions GetCursorPos and SetCursorPos together in order to simulate the mouse being unmovable.  You wouldn't be immobilizing the mouse cursor, but instead you would just be constantly moving the cursor to a set position every time.

 

One problem exists however and that is the fact that the Get Cursor Pos returns an LPPOINT structure.  Since LabVIEW can't handle structs in the Call Library Function Node, you will have to make a C wrapper DLL that calls the function and puts it in more useful values.  

 

GetCursorPos

SetCursorPos

0 Kudos
Message 4 of 5
(3,209 Views)

David

yes, that's the way my thinking was heading. I was actually looking at microsoft website with just that in mind when your reply posted.

 

Thanks for your interest

 

Regards

Ray

0 Kudos
Message 5 of 5
(3,207 Views)