NI Home > Community > NI Discussion Forums
Reply
Member
Michael.Johnson
Posts: 23
0 Kudos

How do I enter CTRL+C into a string control in LabVIEW?

I want to pass a string equating to the keyboard combination of CTRL (the CONTROL key) & C (the alphabetic character key) to an application from LabVIEW via a CIN/DLL call... does anybody know how I would go about doing this up using a string control, string constants or equivalent in LabVIEW ?

Thanx...

M.J.
Trusted Enthusiast
chilly_charly
Posts: 3,438
0 Kudos

Re: How do I enter CTRL+C into a string control in LabVIEW?

Control-C correspond to the ASCII char $03. So you just have to define it as constant : drop a string constant on the diagram, right click to convert to hexadecimal display and type in 03. Now you can concatenate it to any other string and feed it to down-stream vi's
Hope it's what you were waiting for...

CC
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...        
Active Participant
m3nth
Posts: 310
0 Kudos

Re: How do I enter CTRL+C into a string control in LabVIEW?

For terminal applications or DOS, pressing control plus A through Z generates ASCII characters 1 through 26 respectively. So Control+C generates ASCII character 3. To generate this as a string constant you can use there are probably several methods.

Method 1: Drop a numeric constant on the Block Diagram. Right click the constant and change the representation to U8. Change the U8 constant value to 3. Now drop the Type Cast function on the Block Diagram. Wire the U8 constant to the input of the type cast. The default output is a string I think, and you can wire any string constant to the type indicator of the Type Cast function to be sure.

Method 2: Place a U8 Array to String conversion on the Block Diagram. The string output of the conversion may be wired to your CIN/DLL. For the input, create a constant by right clicking on the input node. An array of U8 constant should appear. Put the number 3 in the first number of the array.

I think I forgot what is probably the easiest way... setting the display for a string control as hex display. Using a hex displayed string I think you can enter the ASCII value in plaintext and it gets converted, so you would make sure it says 0x03, and wire it to your CIN/DLL.

I don't have LabVIEW around at the moment to make sure the details on the last item are completely correct. You should be able to get one of those to work though.