LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

keyboard

Highlighted

Hi everybody
I need to write with my keyboard in an application such as notepad
but every time I type a letter should go quickly to activate the notepad to write leg
.
I want my keyboard to function like windows keyboard

regards

Johana

0 Kudos
Message 1 of 15
(1,345 Views)
Highlighted

Does it have to be Notepad or some other application, or can you capture the text within LabVIEW?

 

Does the application need to be able to connect with various other applications or just Notepad?

______________________________________________________________________
0 Kudos
Message 2 of 15
(1,343 Views)
Highlighted

i need only write no matter which application
i want write in everywhere for example internet search, rename a file etc..
with this keyboard i can write everywhere, but i should change all time the windows
just try you will see, but should very fast change the window where you want to write

0 Kudos
Message 3 of 15
(1,339 Views)
Highlighted

keybd_event is not the function you want to use. That generates a keyboard event for the foreground thread, and in your case that's your LabVIEW app. You need to use the SendMessage/PostMessage function to send a message to a specific window. You can use the FindWindow function to get the hWnd of the window in question. The difference between the two is that SendMessage will wait until the other thread has processed the message while PostMessage does not.

 

If you don't want to mess around with the intricacies of the Windows API you can use something like AutoIt to act as an intermediary for you. It has an ActiveX interface which makes programming a lot easier. Don't know if it will have the speed you're looking for, though.

Message 4 of 15
(1,314 Views)
Highlighted

I think my problem is keyboard focus
i think, that I can get it with Flashwindow funtion

have you another idea? i dont understand the sendmessage funtion

0 Kudos
Message 5 of 15
(1,291 Views)
Highlighted

Your VI is the one that has focus. Thus, it's the one that should have keyboard focus. FlashWindow will do nothing for you. Why would you want to use that function? If you can't figure out SendMessage/PostMessage then an alternative is to do the following when you press a key on your VI:

  1. Set the other application's window as the active window.
  2. Use the SendInput function to send the character.
  3. Make your VI the active window.

For (1) and (3) you can use the Windows API Function Utilities (32-bit) for LabVIEW . For (2) you can find a nice example here: http://forums.ni.com/t5/LabVIEW/Does-LabView-have-a-function-similar-to-SendInput-from-C/m-p/793119#.... The caveat is that you will see the windows becoming active/inactive all the time.

 

If I have time to putter around today I can try to play around with SendMessage and PostMessage.

0 Kudos
Message 6 of 15
(1,282 Views)
Highlighted

Saverio,

 

I prefer your original suggestion.  This last one can get messy 😞

 

R

______________________________________________________________________
0 Kudos
Message 7 of 15
(1,269 Views)
Highlighted

Attached is an example that you can play around with that uses PostMessage. See if it works for you.

 

Notes:

  • For applications like Notepad you actually need to get the handle to the child window. The edit box is actually a child window of Notepad. This is done via the FindWindowEx function. For something like Calculator this is not necessary.
  • You had the event structure set up based on creating an array. This isn't necessary if you use PostMessage unless you want to send multiple characters, and I'm not sure why you'd need to do that.
Message 8 of 15
(1,267 Views)
Highlighted

Ileg tlegrlegilegelegdleg ilegtleg,leg blegulegtleg Ileg tleghlegilegnlegkleg Ileg dlegilegdleg slegolegmlegelegtleghlegilegnleggleg wlegrlegolegnleggleg!leg

 

HlegElegLlegPleg!leg

0 Kudos
Message 9 of 15
(1,252 Views)
Highlighted

@PiMaster wrote:

Ileg tlegrlegilegelegdleg ilegtleg,leg blegulegtleg Ileg tleghlegilegnlegkleg Ileg dlegilegdleg slegolegmlegelegtleghlegilegnleggleg wlegrlegolegnleggleg!leg

 

HlegElegLlegPleg!leg


Parlez-vous français?

0 Kudos
Message 10 of 15
(1,247 Views)