"Jeffrey Travis" <[EMAIL PROTECTED]> wrote:

>Does anyone know of a way to detect keyboard strokes even when LabVIEW is
>not the active application (eg, detect typing in MS Word from LabVIEW)?

You will need to install low level system hooks for something like that.
The way this is done is you install a callback function through a WinAPI
function SetWindowsHookEx() for a pecific type of event and the system
then calls this callback function every time before it dispatches an
event matching the hook you installed to the currently active window.

LabVIEW can not really generate callback functions to be installed like
that so you would have to write a small DLL in C which does this for you.
The whole story and its implications are however very involved and system
callbacks have to be very specific. If they do not return as fast as
possible your entire system is going to crawl like a snail so dispatching
those events to LabVIEW through a queue or something is quite out of
question unless you only want to snoop at the key strokes but not influence
them in any way.
Also the events you receive are as far as I remember raw key scan codes.
Translation into actual characters and keys would then be necessary.

If you are interested in further information I would recommend you to read
through 
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/msdn_hooks32.asp>
(line may be wrapped).

Rolf Kalbermatter
CIT Engineering Nederland BV    tel: +31 (070) 415 9190
Treubstraat 7H                           fax: +31 (070) 415 9191
2288 EG Rijswijk        http://www.citengineering.com
Netherlands             mailto:[EMAIL PROTECTED]
 


Reply via email to