LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulate underscore keystroke

Hello Community,

 

I'm trying to programmatically simulate the underscore "_" keystroke.  I'm using the keybd_event from the user32.dll set-up in a call library node as follows:

 

void keybd_event(unsigned char bVk, unsigned char bScan, unsigned long dwFlags, unsigned long dwExtraInfo);

 

I found an example of what I want to do written in VC++ below, but can't understand it fully:

 

keybd_event(VK_SHIFT, 0, 0, NULL);
keybd_event(VK_OEM_MINUS, 0, 0, NULL);
keybd_event(VK_OEM_MINUS, 0, KEYEVENTF_KEYUP, NULL);
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, NULL);

 

I understand that the first line of code above is pressing down the shift key, the second line of code is pressing down the minus key (which is the underscore key when shift is previously pressed and held down), the third line of code is releasing the minus key, and the fourth line of code is releasing the shift key.

 

Does anyone know how to do this in the LabVIEW programming language?  What values can I send LabVIEW to mimic the VK_SHIFT and VK_MINUS values in C++?  I can simulate all of the letters and numbers, but can't figure out how to simulate the underscore.

 

 

Thanks,

 

Andy

 

 

P.S. - I'm using the LabVIEW 7.1 Programming Language and can't migrate my code to LabVIEW 8, 8.20, or 8.5 so please don't post a solution with functionality available in LV8.x that is not available in LV 7.1.

 

0 Kudos
Message 1 of 3
(3,615 Views)
Here is the VI I wrote for the API call.

I used MSDN to find the header file used and then searched google for soemone who had a copy of it.  If you have Visual Studio, then you have the header file.
0 Kudos
Message 2 of 3
(3,613 Views)

Matthew K...,

Thank you for posting your keyboardEvent.vi.  It helped me create the solution to my problem of simulating the "_" (underscore) keystroke programmaticlly.

I have attached the VI that I put together to verifiy that the "_" symbol was generated:

 

 



Message Edited by AMac on 12-13-2007 10:41 PM
0 Kudos
Message 3 of 3
(3,591 Views)