NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to response to a mouse event using ActiveX automation or Windows API in Teststand?

How to response to a mouse event using ActiveX automation or Windows API in Teststand?
 
Thanks!
Jacky
0 Kudos
Message 1 of 5
(3,665 Views)
To enable someone to answer your question,  you might need to be more specific about what you are trying to accomplish.
0 Kudos
Message 2 of 5
(3,651 Views)
Hi Jacky,

James is right. A few more details about what it is you're trying to do would be useful. Generally speaking you can communciate from TestStand with anything that uses ActiveX using the ActiveX / COM adapter. You simply need to specify the Automation Server to use as well as the methods or properties you're trying to use.

If you give us a better idea about your end goal, perhaps we can suggest an appropriate solution.

Let us know Jacky, and have a good day!
Dan Weiland
0 Kudos
Message 3 of 5
(3,632 Views)
Sorry about that and thanks for your kindness.
My question is that I'm trying to find a way by inserting an ActiveX automation or DLL adapter step to get a response from mouse event. For example, when right  clicking mouse, that step will return a value of 1, while left clicking, return another value -1. I don't know how to implement it.
 
Thanks again
Jacky
0 Kudos
Message 4 of 5
(3,627 Views)
Jacky,

Are you going to display a popup or dialog when the user is to click the mouse button?  Will you use the button click as a conditional in your sequence?  For example, if the left mouse button is clicked then Sequence1 is executed and for the right mouse button Sequence2 is executed?  An alternative may be to use the MessagePopup step type.  You can specify specific captions for the buttons in the MessagePopup and also determine which button has been pushed.  This is held in the MessagePopup step container as Step.Result.ButtonHit.  You can assign the response value to a Local variable by adding a Post-Expression "Locals.ButtonResponse = Step.Result.ButtonHit".  Where ButtonResponse is a numeric defined in your Locals context.  You can then use the value of the Locals.ButtonResponse as a conditional value for your sequence execution.

If you are running your Sequence in an Operator Interface, you can also capture mouse events for the User Interface ActiveX controls including the SequenceView.  Each control captures a MouseDown, MouseUp, and MouseMove event which can be captured and interpreted.  The event callback also contains information about which button was actually pressed.  However, the Operator Interface controls function outside of your Sequence execution, so this may not be the functionality you are looking for.

The final option is to use a code module to capture mouse events.  Normally a graphical Windows application runs with a message queue.  When an event occurs the event data is added to the queue.  The message handler is run in a loop.  The handler function removes events one by one off the queue and handles them.  In an application that uses the Windows API, the messages may include Mouse Down and Mouse Up events.  However, for a code module that is being called from TestStand, the normal structure does not apply.  This is why it is easier to capture Mouse Events for a specific control built into a dialog.

Perhaps you can explain a bit further what it is you are trying to accomplish and we may be able to provide an implementation suggestion.

Thanks,

Tyler Tigue
0 Kudos
Message 5 of 5
(3,617 Views)