LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Show/Hide icon of my application in the Window taskbar at run time

Solved!
Go to solution

Hi all,

I'd like that my application is hidden in the tray when the user minimizes it.
The portion of the tray handling works correctly, but I'm not able to manage a small detail:
When the application is minimized in the tray, the panel becomes invisible but the application icon remains in the Windows taskbar. But I want the icon in the taskbar to disappear when the application is hidden in the tray and to reappear when the panel is visible.

 

In this document http://digital.ni.com/public.nsf/allkb/6E660558F3D420C786256FCB005B4F52 is reported how to hide the taskbar icon. It works but it cannot be applied at run time.

 

MSDN documents report this:

To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.

The Shell will remove a window's button from the taskbar only if the window's style supports visible taskbar buttons. If you want to dynamically change a window's style to one that doesn't support visible taskbar buttons, you must hide the window first (by calling ShowWindow with SW_HIDE), change the window style, and then show the window.

So, I've tried to use WINAPI (user32.dll) but without success.

 

 

0 Kudos
Message 1 of 8
(12,870 Views)

Hi i,

 

did you try the INI key "HideRootwindow=True" for your executable?

Don't you get a taskbar entry when your main window is open?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(12,866 Views)

Hi all,

 

Sorry, I've duplicated my post of some hours ago because, for some reason, I receive e-mail notifications related to my post but I'm not able to view it anymore.

 

Here is my problem:

 

I'd like that my application is hidden in the tray when the user minimizes it.
The portion of the tray handling works correctly, but I'm not able to manage a small detail:
When the application is minimized in the tray, the panel becomes invisible but the application icon remains in the Windows taskbar. But I want the icon in the taskbar to disappear when the application is hidden in the tray and to reappear when the panel is visible.

In this document http://digital.ni.com/public.nsf/allkb/6E660558F3D420C786256FCB005B4F52 is reported how to hide the taskbar icon. It works but it cannot be applied at run time.

 

MSDN documents report this:
To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.

The Shell will remove a window's button from the taskbar only if the window's style supports visible taskbar buttons. If you want to dynamically change a window's style to one that doesn't support visible taskbar buttons, you must hide the window first (by calling ShowWindow with SW_HIDE), change the window style, and then show the window.

So, I've tried to use WINAPI (user32.dll) but without success.

 

As suggested by GerdW, I've already tried the INI key "HideRootwindow=True" for my executable. It hides the application icon in the taskbar, but I cannot show/hide it at run time.

0 Kudos
Message 3 of 8
(12,905 Views)

So, I've tried to use WINAPI (user32.dll) but without success.

 

No need to reinvent the wheel.

You can download:

Windows API Function Utilities (32-bit) for LabVIEW

http://www.ni.com/example/29935/en/

 

 

 

George Zou
0 Kudos
Message 4 of 8
(12,864 Views)
Solution
Accepted by topic author sqrt(-1)

For application.exe in file application.ini add row HideRootWindow=True

When you activate VI, set VI-> Property node Front Panel window.Minimizable = True, show window (invoke node VI.Open, window state = standard).

When hiding, you need to track that, set Minimizable = False

Taskbar icon will appear and disappear with window

 

hide-show app.png

Message 5 of 8
(12,839 Views)

Thanks Alexander. I just needed to set Minimizable = FALSE

 

It works fine!!

 

 

 

0 Kudos
Message 6 of 8
(12,823 Views)

Thanks for your tips, Alex... 

I got what I expected !!!

0 Kudos
Message 7 of 8
(10,880 Views)

Hi Alexander

For app.exe  is  okay;

But it doesn't work  when I run VI directlly as i follow below .png shortcut ,still show its icon in taskbar;

Do you have other methods ?

Thx

 

 

hide-show app.png

0 Kudos
Message 8 of 8
(5,230 Views)