LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Avoid window getting focus after pressing a mouse button on it

I want that a window does not get focus although I press a mouse button on it, in Windows XP.

 

I have search in Microsoft help and this fact is controlled by the Operating System itself. The notification that is sent after the user presses a mouse button is WM_MOUSEACTIVATE notification. The return value of this notification indicates the behaviour of the window after the mouse down, existing 4 options: MA_ACTIVATE, MA_ACTIVATEANDEAT; MA_NOACTIVATE & MA_NOACTIVATEANDEAT. The default is the first one, but I want to change the behaviour of the window to be the the third one: MA_NOACTIVATE, that does not activate the window, and does not discard the mouse message. The function that performs this is DefWindowProc according to the MSDN Help content.

 

Any help about doing this in Labview? Is there any special function in Labview that allows setting this behaviour to a window or should I use a Windows dll? In that case how can be programmed? Has anyone done it before? I'm working with Labview 8.6.1, and I haven't found anything about this. Any help will be very useful.

 

Thank you very much in advance.

 

David Fernández

0 Kudos
Message 1 of 5
(3,060 Views)

Is the window you are talking about a LabVIEW program, or some other program?
You can do all types of stuff with a LabVIEW window using property nodes to manage the window focus property.

Cory K
0 Kudos
Message 2 of 5
(3,052 Views)

It is the front panel window of a VI which I don't want to get focus. I have tried to achive this with property nodes, but the problem I think that cannot be solved in this way, because is the Operative System that gives the focus to the window when pressing a mouse button before Labview does anything. You can release the focus once the window have taken it with the Front Panel window focus property node, but what I really want is to keep the focus on the old window.

 

My idea is that the VI act as a background of my application, so never can be over the rest of the windows. Some of them are floating but others are standard and I don't want to use modal windows, so I cannot solve this with the Window Appearance options.

 

I have also tried to discard the mouse down in the Mouse Down? event, but I doesn't work, the window continues getting the focus although does not carry on any action.

 

Any suggestion?

 

Thank you for your interest

 

David F

0 Kudos
Message 3 of 5
(3,041 Views)

I'll try some poking around, but in the mean time, you could try checking that property every so often.

Use the window focus property as read (instead of write), if it is true, set it to false.

I'm not sure if this will send it to the back, or simply take it out of focus, but I'll check.

Cory K
0 Kudos
Message 4 of 5
(3,038 Views)

Is it a status window or do you want to interact with it?  Looked up MA_NOACTIVATE and IMHO think that it doesn't look to be a vialble option as you would have to handle the DefWindowProc function which would be way outside of LV's domain.  If you want to do something like this, you would be better off with another language that is more capable than LV.  If you really want to use LV for other things, then make your LV into a DLL and link up to it.

 

 

A

0 Kudos
Message 5 of 5
(3,030 Views)