LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to move mouse programatically but losing control when I move it manually

I'm writing some code that performs some tasks programatically by movinvg the mouse for me using the SetCursorPos function of the user32.dll

 

This seems to work OK except until I try to do something else manually with the mouse (my program includes some automated components and some manual ones so this is necessary). When I do something manually with the mouse, the programattic control stops working and no longer will move the mouse for me.

 

Is there a way for me to resume control over the mouse when I need my program to take control again? Thanks!

0 Kudos
Message 1 of 3
(2,473 Views)

I have not had that isse before.  Can you reduce your code down some (to hide the propriatary stuff) to just enough to show the problem?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(2,443 Views)

I can try but that might be hard to do. One thing my program is doing when I automatically move the mouse is clicking on a button in another program. That's when it seems to lose the control, and I think making that other program the active window is interfering with the SetCursorPos. Is that something that could happen? Any ideas how to solve for it? Maybe I could make Labview the active window again after I click, but I'm not recalling how to do that or if it would make a difference.

 

Thanks for your help!

0 Kudos
Message 3 of 3
(2,408 Views)