LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Virtual Keystroke of decimal separator using User32.dll

Solved!
Go to solution

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.

 

0 Kudos
Message 1 of 8
(925 Views)
Solution
Accepted by topic author wireconnector

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 😕




Heads up! NI is moving LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 2 of 8
(906 Views)

This is perplexing.  Do you have any documentation on the messages?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 8
(901 Views)

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

 

 

Message 4 of 8
(895 Views)

This might help you for period.

KEYBOARD.PNG

0x6E is the hex value for this

And you can use 188 or 0xBC for comma


CLD Using LabVIEW since 2013
Message 5 of 8
(880 Views)

Yes,

the link you provided is the correct reference.

For my purpose also 110 (decimal) and 188 (comma) are working.

Thank you very much.

0 Kudos
Message 6 of 8
(834 Views)

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

0 Kudos
Message 7 of 8
(832 Views)

Yes, it is working just as in the screenshot you provided.

Thanks

0 Kudos
Message 8 of 8
(830 Views)