Nicola Cesca Posted March 3, 2013 Report Share Posted March 3, 2013 Hi all. I need to control a vi sending event (keydown) from a different vi. Want I'd like to do is some kind of keylogger, so i want to cacth the keystroke,log it and then send it to the second vi. I guess it's possible to do it with register events subvis. Quote Link to comment
Ravi Beniwal Posted March 4, 2013 Report Share Posted March 4, 2013 Hi Nicola, just to make sure I understand this correctly, you want two VIs with the following functions: VI1: Is (part of) the UI. VI2: Is a keylogger. It gets some reference to VI1 and then log any keystrokes that VI1 receives. Please see the attached files. Run KeyLogger.VI, which will launch VI1.vi and register for its keystrokes. KeyLogger.vi VI1.vi Quote Link to comment
Nicola Cesca Posted March 5, 2013 Author Report Share Posted March 5, 2013 hi Ravi, unluckly I can't open the vis you posted cause I have LV2009 and you did them with 2011... If can repost them i will appreciate. thanks Quote Link to comment
Ravi Beniwal Posted March 5, 2013 Report Share Posted March 5, 2013 Here are the VIs saved for 2009. Please note that this is just a quick example to show the functionality, which is why the KeyLogger is launching VI1 (and is only displaying the keystrokes and not logging them). For your real KeyLogger, you will need to use some methods to find out which VIs are in memory and open references to them (may be register for events if the FP is open). You could use "Application:All VIs in Memory" property every now and then to see if new VIs have been launched. KeyLogger.vi VI1.vi Quote Link to comment
Nicola Cesca Posted March 6, 2013 Author Report Share Posted March 6, 2013 Thank you. The example is ok. I have another question related: is it possible to have a vi running always on top, type on that and that vi send the events to the desired vi. Something like on-screen-keyboard with the keyboard focused that send the button pressure (corresponding to a keyboard keystroke) to a desired vi running? I'm not sure I said it in the right way. Quote Link to comment
Ravi Beniwal Posted March 7, 2013 Report Share Posted March 7, 2013 Sure. One way to do this is by using user events. So the VI with the on screen keyboard creates a user event that any other VI can register for. The keyboard VI will get the user input by looking for value change on the keyboard buttons. If the user uses the physical keyboard, you could use the key down event to read the key stroke (and briefly depress the corresponding key on your virtual keyboard). In either case, since you know which key the user intended to press, you can fire the user event with the details. Any other VI can register for and get this user event. Quote Link to comment
Nicola Cesca Posted March 18, 2013 Author Report Share Posted March 18, 2013 thank you for the description, but i tried to do what you wrote without any success... probably i didnt understand the way events work. Quote Link to comment
Nicola Cesca Posted May 3, 2013 Author Report Share Posted May 3, 2013 Hi all. I need help understanding events handling. Quote Link to comment
todd Posted May 3, 2013 Report Share Posted May 3, 2013 1) "Create User Event" 2) Make that event (the wire) available to all the VIs that will generate it or respond to it. 3) For each VI that should respond to it, "Register for Events". Only wire that event ref to one event structure (ES). Other ES can register for the event, too. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.