LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW EXE Multi Taskbar Behavior

Okay so I did some searching and the keywords are hard since most people complaining about this are in the IDE and not an EXE but I expect the reasoning is the same.  I have an application that when started shows two windows.  This runs on a computer with two monitors.  On startup I have each of the windows figure out which monitor they should be on and maximize them to each.  This all works fine. 

 

The part that isn't working right is the fact that both windows get put on the same monitors taskbar, and can't be moved.  In Windows 10 there is a setting for multiple taskbars, and there are a few settings but the one that seems to do what I want is where the window is only on the "task bar where window is open".  If I open a Windows Explorer window this works like I'd want.  If I drag the Explorer window to the second monitor, the taskbar item moves to that second monitor and if I move it back, it moves back.  This way there is only one icon in the taskbar for a particular window, and that item is on the taskbar at the bottom of the monitor that the window is on.  Very intuitive, and it is how the users expect it to operate.  So of course it doesn't work right in LabVIEW...

 

Attached is a project, and an EXE which is made from the project.  When ran it will show the main VI front panel, and create two other windows with graphs on them.  I've given each window a unique title, and icon.  All three icons for each of the three windows will be on the primary taskbar after running the EXE.  If I move all three windows to another monitor, then the entry still remains on the primary taskbar, and not the taskbar at the bottom of the monitor that the window is on.  Why does it behave this way?  There isn't any window open on the primary monitor, they are all moved, so why does Windows think this is the "taskbar where the window is open"?

 

I've also messed with the Combine Taskbar Buttons and set both the primary taskbar, and the other one to "Never" and that didn't help.  Any suggestions other than splitting this up into two EXEs?  This is on Windows 10, LabVIEW 2018 SP1 x86.

 

Attached is the image showing that even though all three windows are on the second monitor, the taskbar icons all are together on the wrong monitor.  But you can see the Windows Explorer doing what it should.

Untitled.png

Download All
0 Kudos
Message 1 of 13
(4,610 Views)

Okay so this might not entirely be LabVIEW's fault, but if you ask Microsoft they would say it is entirely LabVIEW's fault.  I found that if I move one of the three windows to another monitor, and then restart Windows Explorer, it properly shows the windows on the right taskbars for where the monitors are.  If you move them around, they still don't move but it is a start. 

 

I've also download 7+ Taskbar Tweaker which has lots of cool settings with grouping and adjusting behavior of the taskbar.  I found that if I toggle Don't group pinned items, and then toggle it again, it forces the taskbar to refresh in a way that windows appear where they should.  So a refresh of the taskbar or restart of explorer does temporarily fix it.  I can task kill explorer all day long, but it would be pretty annoying to do this every time a user moves a window to another monitor.  Especially since that operation closes all open Windows Explorer windows.  I've email the developer to try to get some incite into how to refresh the taskbar without restarting explorer but until then any other suggestions are appreciated.

0 Kudos
Message 2 of 13
(4,580 Views)

Taskbar is just another window. 

Catch the Windows message when it got refreshed, and do the same in LabVIEW to refresh it.

 

 

George Zou
Message 3 of 13
(4,570 Views)

@zou wrote:

Taskbar is just another window. 

Catch the Windows message when it got refreshed, and do the same in LabVIEW to refresh it. 


 

Really?  I had no idea the tasbar has a HWND like other windows.  Do you have an example on how to capture Windows messages for an HWND?  Preferably a method using LabVIEW?

 

Edit: I found the Windows Messaging Library for LabVIEW and will be playing around.

0 Kudos
Message 4 of 13
(4,531 Views)

Do you have an example on how to capture Windows messages for an HWND?

Use Microsoft Spy++ to capture the message manually.

You only need to do this once.  The message won't change.

 

George Zou
Message 5 of 13
(4,523 Views)

Try this:

Call FindWindow() with the class name of "Shell_TrayWnd"

Call UpdateWindow().

 

George Zou
Message 6 of 13
(4,511 Views)

@Hooovahh wrote:

 

Attached is a project, and an EXE which is made from the project.  When ran it will show the main VI front panel, and create two other windows with graphs on them.  I've given each window a unique title, and icon.  All three icons for each of the three windows will be on the primary taskbar after running the EXE.  If I move all three windows to another monitor, then the entry still remains on the primary taskbar, and not the taskbar at the bottom of the monitor that the window is on.  Why does it behave this way?  There isn't any window open on the primary monitor, they are all moved, so why does Windows think this is the "taskbar where the window is open"?

 

I've also messed with the Combine Taskbar Buttons and set both the primary taskbar, and the other one to "Never" and that didn't help.  Any suggestions other than splitting this up into two EXEs?  This is on Windows 10, LabVIEW 2018 SP1 x86.

 

Attached is the image showing that even though all three windows are on the second monitor, the taskbar icons all are together on the wrong monitor.  But you can see the Windows Explorer doing what it should.

Untitled.png


I have never heard of this behavior in Windows before.  I have 2 monitors with the desktop extended across them.  No matter which monitor a window is open on, the window shows up on both task bars.  On my primary monitor it is the wider buttons that show all or part of the window name.  The secondary monitor shows all the same windows, but shows them in small size without the titles.  If I move a window from one monitor to the other, nothing about the appearance of either taskbar changes  This is all in Windows 10.

 

Do you have different settings on your monitor arrangements?

 

 

EDIT:

I just googled and discovered this.  https://superuser.com/questions/1162515/show-corresponding-icons-for-each-monitor-on-task-bar

Apparently default options pretty much give me the everything on both taskbars.  I never saw these other options because they disappear off the bottom of the taskbar settings page.

 

And these stupid flat styles that everyone is going to nowadays, the scrollbar that is on the side (a skinny grey line) is so non-obvious I had no idea there were twice as many settings.

 

Capture

Message 7 of 13
(4,495 Views)

@zou wrote:

Taskbar is just another window. 

 

 

Message 8 of 13
(4,492 Views)

@BertMcMahan wrote:

@zou wrote:

Taskbar is just another window.  


[MindBlown - Youtube]


Yeah no kidding, I typed up a long message that basically was "What are you talking about?  You're crazy!" Only for me to do a quick google search and have the same reaction as you. 

 

So it took some time to get the tools to look into stuff.  Eventually I got Spy++ going and saw the 30 or so messages sent back and forth when I clicked a setting that would would force a refresh of the taskbars.  I tried all sorts of things and researched various messages and payloads, and creating notification headers to get the reply, and I tried AutoIt scripts meant to refresh the desktop, or system tray icons, and I looked into the fact that the taskbar actually had I think 4 HWNDs for the primary taskbar alone and I tried sending various messages to each.  I did find one that would refresh properly but it took up to 5 seconds to perform the task.

 

In the end I found a pretty stupid simple solution that I should have thought of.  If I detect that a window moved to another monitor, then send the Windows command to hide that HWND, and then show that HWND again.  This causes the icon to get removed from the taskbar (of course) and then reshown properly.  Attached is a very quick and dirty update that polls what monitor the window is on (just the two reentrant ones not the main) and if it is different it hides and shows.

 

BTW has no one made a SendMessage API in LabVIEW that wraps some of these functions into VIs with appropriate inputs?  It probably would have came in handy at some point in my journey. 

 

Also NI is this a bug?  Can we get a CAR, or do I need to sprinkle in this VI in my applications that I expect to be on Windows 10 with multiple taskbars?

0 Kudos
Message 9 of 13
(4,446 Views)

...In the end I found a pretty stupid simple solution that I should have thought of.... 


Could you downconvert this to an earlier version? (2016? 2017?)

0 Kudos
Message 10 of 13
(4,440 Views)