07-27-2011 11:50 AM
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
07-27-2011 11:54 AM
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?
07-27-2011 12:06 PM
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
07-27-2011 01:54 PM
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.
07-28-2011 03:38 AM
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
07-28-2011 08:40 AM
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:
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.
07-28-2011 01:52 PM
Saverio,
I prefer your original suggestion. This last one can get messy 😞
R
07-28-2011 01:56 PM
Attached is an example that you can play around with that uses PostMessage. See if it works for you.
Notes:
07-28-2011 04:39 PM
Ileg tlegrlegilegelegdleg ilegtleg,leg blegulegtleg Ileg tleghlegilegnlegkleg Ileg dlegilegdleg slegolegmlegelegtleghlegilegnleggleg wlegrlegolegnleggleg!leg
HlegElegLlegPleg!leg
07-28-2011 05:09 PM
@PiMaster wrote:
Ileg tlegrlegilegelegdleg ilegtleg,leg blegulegtleg Ileg tleghlegilegnlegkleg Ileg dlegilegdleg slegolegmlegelegtleghlegilegnleggleg wlegrlegolegnleggleg!leg
HlegElegLlegPleg!leg
Parlez-vous français?