Jeff

Not sure if it will work for you but you can use the Acquire input data.vi
from the input device control pallete to read KB input no matter which
program has the focus....


Dan Bookwalter N8DCJ
Hi-Stat a Stoneridge Co.
345 South Mill St.
Lexington, Ohio 44904
 
(419) 884-1219 Phone
(419) 884-4172 Direct
(419) 884-4195 Fax
 
[EMAIL PROTECTED]
 

-----Original Message-----
From: Rolf Kalbermatter [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 3:46 AM
To: 'Jeffrey Travis'
Cc: Info LabVIEW (E-mail)
Subject: Re: Detect keyboard strokes outside LabVIEW?

"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]
 


_____________________________________________________________________ 
This electronic mail transmission contains confidential information 
intended only for the person(s) named. Any use, distribution, copying 
or disclosure by any other person is strictly prohibited. If you 
received this transmission in error, please send an electronic mail 
message to [EMAIL PROTECTED] 



Reply via email to