LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the key commands for mouse clicks on another windows program

Hi, I need to automate a few executable programs with LabView. When those programs running independently, some mouse clicks are performed on their menu. I need to automate the process. So I need to know the corresponding key command for those mouse clicks. Could someone kindly point out a way?  Many thanks.
Bryan
0 Kudos
Message 1 of 23
(4,964 Views)

Use Spy++ (comes with VC/C++), you can catch the Windows message (or application defined message).

Then, you can use LabVIEW to send the message to the application, simulating a menu selection.

 

George Zou

http://gtoolbox.yeah.net

 

George Zou
0 Kudos
Message 2 of 23
(4,950 Views)
Hi George, I didnt find Spy++ in your link. Could you post it or email me?  I wonder if there is a Labview solution to this?  Thanks again.
0 Kudos
Message 3 of 23
(4,943 Views)
Spy++ comes with VC/C++.  It's not free.  I can't redistribute it.
 
There are other free options, like WinSpy: www.catch22.net
 
 
George Zou
 
 
George Zou
0 Kudos
Message 4 of 23
(4,942 Views)

Hi George, I found the following windows message for my mouse click (on an OK button) operation using Spy++:

<00036> 009D0160 P WM_MOUSEMOVE fwKeys:0000 xPos:12 yPos:12

<00037> 009D0160 S WM_MOUSEACTIVATE hwndTopLevel:010601E0 nHittest: HTCLIENT uMsg: WM_LBUTTONDOWN

Now I need to emulate this process using LabVIEW.  I have downloaded lvwutil32 but didnt find a vi that allow me to move the mouse cursor to certain position on certain window. Could you suggest a solution or vi to do this.   I have tried to send message by System Exec.vi, but had no success.  Urgent help needed for a deadline. Thanks again.

0 Kudos
Message 5 of 23
(4,922 Views)
Use Spy++ to monitor the parent window of the button, you should be able to get the results of left button down.  That's what you should simulate.  Don't simulat click button.
 
George Zou
 
George Zou
0 Kudos
Message 6 of 23
(4,919 Views)
George, I got a message like:  uMsg:WM_LBUTTONDOWN[wParam:00AD01A8 IParam:02010001],  is this the message to pass with System Exec.vi?  I tried it, it was not doing anything.  Is there another Windows API vi I can call to do this?
0 Kudos
Message 7 of 23
(4,917 Views)
This must be very hard for LabView to do.  I just need to use LabView to run another application. Then have labview emulate a mouse click on that application. I have found out the windows message using Spy++ for the mouse click.  Now in LabView I need to move the mouse to a certain position on that application.  How could LabView know where to move the mouse cursor.  I found some move cursor vi on this forum, then the coordinate of the position on the application (the active window) is not known.  Do I need to map out the position in advance using Spy++?  That seems not reasonable as later on the position may change. 
 
LabView is indeed good for Hardware automation and data acquisition, but when it comes to performing some software automation tasks (i.e., runing a couple of other applications automatically), it doesn't seem to be powerful at all, unless the other applications are ActiveX capable, or you have their code to build Dlls.  Most of time, one only need to automate the process of running a couple of other programs, then have data presented.
0 Kudos
Message 8 of 23
(4,910 Views)
You usually have to buy a product to do this. The task is called "GUI unit testing". Here is a FAQ that lists a lot of products.

http://www.testingfaqs.org/t-gui.html

I am not aware of a LabVIEW add-on that has this function.

0 Kudos
Message 9 of 23
(4,895 Views)
Hi Odd_Modem, I believe I am getting very close on this. I can move my mouse and click it. The only thing missing is to know the screen coordinate for the position I want to move to. I am calling windows API so I can set my window's position. All I need to know is the "Button" position on the window of my application, so that I know its Global position on the screen. I need a way to map out the button and other positions such as pull-down menus.  Thanks for the suggestions though, I still dont want to give up on it with my own coding at this moment.
0 Kudos
Message 10 of 23
(4,889 Views)