Programmatically Type Keystrokes in LabVIEW and LabWindows/CVI
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Professional Development System
I would like to be able to programmatically type keystrokes, such as pressing the control key, in programs such as LabVIEW and LabWindows/CVI. Is this possible?
Yes, it is possible to programmatically type keystrokes in any environment that can call a DLL. This can be done by calling the keybd_event function of the user32.dll. The user32.dll is located in the C:\WINDOWS\system32 directory.
The keybd_event function synthesizes a keystroke. It has the following syntax:
VOID keybd_event( BYTE bVk, BYTE bScan, DWORD dwFlags, PTR dwExtraInfo)
Here is an example of how to use this function:
Pressing the Ctrl Key: keybd_event (0x11, 0, 0, 0)
Releasing the Ctrl Key: keybd_event (0x11, 0, 2, 0)
Note: The attached document contains a list of virtual key codes.
External Link: MSDN: keybd_event Function()
Report Date: 03/01/2005
Last Updated: 09/17/2013
Document ID: 3J0BMR1J