From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-17-2021 11:25 AM
I need to use LV to send keystroke to an external executable program that controls an old lab instrument. Basically, I need LV to send a number (let’s say 123.45), a tab, another number and enter.
I tried to use this example https://forums.ni.com/t5/Example-Code/Using-LabVIEW-to-Simulate-Keyboard-Events/ta-p/3996210?profile... based on User32.dll but here both the comma and the period character are not enabled.
I tried also this example (https://labvolution.com/labview-simulating-keyboard-events/) but I was only able to input letters, numbers, tab, and carriage return. When I input the ASCII code for decimal separator (I have tried both 44 and 46) I get no results.
Is this a limitation of windows? I am running LV2019 on Win10 and 10 I have tried both Italian and English language option.
If so, what alternative method is the best option for my need?
Thanks for your help.
Solved! Go to Solution.
12-17-2021 03:57 PM - edited 12-17-2021 03:58 PM
Did you try 190 (period)?
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.keys?view=windowsdesktop-6.0
This may not be the same as for User32.dll but it does appear to have similar functionality. Might be worth a shot 😕
12-17-2021 04:08 PM
This is perplexing. Do you have any documentation on the messages?
12-17-2021 06:51 PM
I did not look into the examples, but I think, they use the keybd_event() function from user32.dll
You have to use the virtual key code (not the ascii code) and thats 0xBC or 0xBE
See this webpage for a complete list of the virtual key codes:
https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
12-17-2021 10:06 PM - edited 12-17-2021 10:08 PM
This might help you for period.
0x6E is the hex value for this
And you can use 188 or 0xBC for comma
12-21-2021 04:26 AM
Yes,
the link you provided is the correct reference.
For my purpose also 110 (decimal) and 188 (comma) are working.
Thank you very much.
12-21-2021 04:34 AM
The link you reported with HEX values it is useful and correct,
the linked example that I am using it is with decimal input so I just have to convert from HEX to DEC.
Thanks
12-21-2021 04:35 AM
Yes, it is working just as in the screenshot you provided.
Thanks