LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mouse event

Hello,
I'm trying to use the user32.dll file and call function nodes to generate mouse events.  I'm using it to automatically click links in an activex internet explorer on the front panel.  I'm using the mouse_event function with 2,0,0,0,0 for left down and 4,0,0,0,0 for left up.  The odd part is that it works sometimes, and not other times.  When it does work, it works every time.  But then I'll restart the program, and it won't work at all.
 
Also, I have 1 second timers in between all of the re-positions and clicks, but that doesn't seem to help.  Like I say, it's an intermittent problem, and I can't find any set of conditions that always cause the problem. 
 
I've looked throught the past postings on items like this.  People suggested using the sendinput function instead, but I didn't see how to use that.  Plus, the mouse_event fuction is in the user32.dll file, so it should work- right?  I also tried downloading something called G-toolbox, but my version of labview won't allow "non block diagram" vi's.
 
Maybe there is some sort of queu that needs to be cleared out before you start calling funtions like this?
Pat 
0 Kudos
Message 1 of 6
(3,772 Views)
Only the active window can get simulated mouse click message.  You can use G Toolbox Capture All Mosue Event to make sure your widnow get the mouse click message.
 
What version of LabVIEW are you using?  You can get G Toolbox Simulate Click for LabVIEW 7.0/7.1 at:
George Zou
0 Kudos
Message 2 of 6
(3,763 Views)
Hi zou, I'm using LV 7.1 and windows xp home.  I downloaded the gtoolbox, and tried it.  I can't seem to make it work.  I've put together a sample vi that includes both the G tool and a mouse event function call, so you can try it both ways.  The other odd thing is that the function call is now working on my system, and I don't like it when problems fix themselves. 
Thanks for the help.
Pat 
0 Kudos
Message 3 of 6
(3,739 Views)

Are you sure the problem is fixed?

The test vi is not working on my computer.  As I said in my last post: only the active window will get the message.  In this case, the active window is your front panel, not the activeX window (which is a grandchild window of your front panel).

If you got Spy++ (come with MS VC), you can see which window actually get the message.

George Zou
0 Kudos
Message 4 of 6
(3,726 Views)
Zou, That's helpful.  I didn't know that the activex control wouldn't be part of the active window.  I'll look into that, and try to find a work around, and I'll also look for that spy thing you were talking about. 
 
Also, did you try it both with the G-tool and the library call?  You can toggle that on the front panel.  I found that it works with the library call, but not with the G-Tool. 
Thanks,
Pat
0 Kudos
Message 5 of 6
(3,724 Views)

Same as what you have experienced: sometimes works, sometimes doesn't with or without G Toolbox.

George Zou
0 Kudos
Message 6 of 6
(3,718 Views)