取消
顯示結果 
搜尋替代 
您的意思是: 

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 積分
1 條訊息(共 5 條)
3,621 檢視

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.

2 條訊息(共 5 條)
3,616 檢視

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 積分
3 條訊息(共 5 條)
3,578 檢視

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 積分
4 條訊息(共 5 條)
3,573 檢視

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 積分
5 條訊息(共 5 條)
3,571 檢視