LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Activating a Window Without Focus

Hello,

 

I'm using LabVIEW 8.6, I would like to give an unusual behavior to a subVI window when opened: I'd like the window to be activated without giving focus to it. What I mean, is that I would like the window to be able to catch even on the front panel like keystroke or mouse click without giving focus to this window. I'd like the focus to stay on another window.

 

A good example of what I want to do is the microsoft visual keyboard installed with Windows: when the visual keyboard in open you can press any button without giving focus to the window. I'd like to reproduce the same behaviour with a labview window.

 

I don't think it's possible with properties or invoke node, I think there might be something to do with the use of user32.dll. If anyone as already done that, or knows how to do it, it would be great.

 

Thanks for helping.

 

Clément

DAM

0 Kudos
Message 1 of 16
(4,479 Views)

Hi Clément,

i'm not sure, but i could be possible if you hook the keyboard events (you have to use a dll for it) and analyse the keys. Then you have to make sure that your program is the first in the event chain. If this is done, you get all keyboard events and you can decide to send them to the next chain participant or not.

 

Hope it helps.

Mike

Message 2 of 16
(4,467 Views)

Hi Mike, thanks for your answer.

 

What is the dll are talking about?

I tried with the LabVIEW and the mouse click event on the pane, but with this you can cancel the mouse click but not the focus given to the window.

0 Kudos
Message 3 of 16
(4,461 Views)

Hi Clément,

search for "keyboard hook"

http://www.google.de/search?hl=de&q=keyboard+hook&meta=

 

Mike

Message 4 of 16
(4,451 Views)

Hi Mike,

 

I'm not really sure about the hook technic, because I still want to be able to press the buttons in my front panel, and not cancelling all the mouse or keyboard events.

 

Thanks

 

Clément

0 Kudos
Message 5 of 16
(4,448 Views)

In your listener VI you could register for events on the VI with the actual Focus.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 16
(4,444 Views)

Hi Ton,

 

I'm not sure to understand what do you mean. Could you give me more details ?

 

Thanks for helping

 

Regards,

 

Clément

0 Kudos
Message 7 of 16
(4,441 Views)

Hi,

 

- Have you tried making the main VI modal? Steps are described in this KB

- To do this programmatically, you will need to use the lvwutil32.dll like here 

 

I googled your question and I found some good information this MSDN forum, I think it may help you to apply it to your code.

 

Hopefuly this helps.

 

Regards, 


Steve M.
Message 8 of 16
(4,358 Views)

Hi Steve,

 

Thanks for your answer.

 

- Making the VI modal is not helping, it just make the vi to be on top of the other windows and prevent the other windows to be bring to front. Also the modal vi is taking focus.

- I already tried to play with the lvwutil32.dll, but it doesn't help.

- I gave some tries with the user32.dll as well but unsuccessfully.

 

Thanks for the link to MSDN forum I didn't find this one, but I'm not sure it can help, it seems that the guy solved his problem using some C# functions.

 

Could you try to search the private forum or internal KBs if you can find something about this subject. If not could you post a question to NIC AEs.

 

Thanks

 

Have a great day

 

Clément

 

 

0 Kudos
Message 9 of 16
(4,324 Views)

Hi Clément,

 

I already have looked for your request in the internal KBs and forums, otherwise I have asked the AEs community and I tell you what happens.

Moreover, I think of making use of the C# code I suggested in the MSDN forum  in LabVIEW. That is to say, build a dll in your C# environment, and use a call library function node in LabVIEW to access that dll.  Or access the assembly which is built for your C# code from LabVIEW using the .NET interface (see the .NET palette in LabVIEW under the Communications palette). 

 

Regards,

Steve M.
0 Kudos
Message 10 of 16
(4,300 Views)