LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Function call which will perform hotkeys

I was wondering if there is something in CVI which will allow me to perform Ctrl + Alt + U.
0 Kudos
Message 1 of 4
(3,117 Views)

Exactly what you are trying to do will determine the appropriate way to do this.

Are you trying to control another application?

Are you trying to send that to a control in your own CVI application?

If the latter, you can either use the FakeKeystroke() call to send the key code to the active window or simply call the control callback with the appropriate panel, control, event and event data parameters set to what they need to be. I do the second method all the time in my programs, usually just sending an EVENT_COMMIT so I don't have to deal with processing other messages.

If you want to control another application, that is a lot more difficult. You will need to enumerate the application windows on the system, find the one you want to control and then send the appropriate keystrokes to the application using SDK functions.

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 2 of 4
(3,112 Views)
I would want to open an application and send a command  which simulates entering hotkeys. For example, opening up microsoft word and while this window is active pressing Ctrl + O.  I can open the application by using LaunchExecutable() but I'm not sure of how to do the rest?
0 Kudos
Message 3 of 4
(3,109 Views)
Why not use ActiveX to do what you want?
 
It's much more powerful and there is an example of using the ActiveX controller with Word in the CVI distribution directory. Anything you can do through keystrokes you can do through ActiveX. It is not trivial to learn but the example code will get you started.
 
If you really want to do the keystroke way of doing this, it is not trivial. You will need to use SDK functions to find the window you want, and then you will have to send Windows messages to the application to fake the keystrokes. This would probably take me a couple of days of digging through SDK documentation and testing to make it work and I am familiar with the Windows messaging architecture. If you don't know how that works, it is going to be a rather steep learning curve.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 4 of 4
(3,101 Views)