Click here to Skip to main content
12,399,799 members (46,603 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB10.0 VB.NET
Hello, I have an app I'm working on that runs in the background and I have a NotifyIcon in the system tray, which I use to notify the user of some things. But now I came to a little problem.

I want to be able to always show the icon next to the system icons, i.e. Action centre, network, sound. And not hidden with other apps whereby you have to click the up arrow to show them.

If your not sure what I mean, there is this thing in control panel under Notification Area Icons which allows you to change what each icon can do, i.e. 'Show icon and notification', 'Hide icon and notifications' and 'Only show notification' <-- that's a Windows 7 example, I don't know how it would be in XP or Vista. But that is basically what I want to do. I want to programmatically set my application to 'Show icons and notifications'.

I know it's possible! I've seen it in action. A program named DropBox - once installed it automatically appears next to the clock and it's icon is always shown.

Here is an image example of how I want it to be: (The arrow shows my application)

http://i719.photobucket.com/albums/ww199/Pk_King_X11/NotifyIconExample.png

------------------------------------------------------------------

EDIT: Please goto: "Control Panel\All Control Panel Items\Notification Area Icons" (Windows 7)

^ You will see each icon has a behaviour, I want to set mine to 'Show icon and notifications' programmatically. I know it is possible... DropBox has done it.

EDIT 2:

OK, now I see how it works. Programs like DropBox and some Anti-Viruses basically change their icon's position in the tray... By changing it to 0 or 1 which ever is the first one, basically puts them right next to the clock, thus automatically changing the Notification Area Icons settings to 'Show icon and notifications', now that's pure genius...

But then comes a question. How could I achieve this?
Posted 28-Sep-12 9:41am
Updated 29-Sep-12 5:14am
v10
Comments
Sergey Alexandrovich Kryukov 28-Sep-12 15:55pm
   
Where is it "hidden"? Doesn't System.Windows.Forms.NotifyIcon do what you want?
--SA
Rokas Gustys 28-Sep-12 16:39pm
   
Yes, I am using the NotifyIcon control for this... And its hidden in the place where it hides inactive icons (like in windows XP). I want it to be 'active' and shown next to the up-facing arrow that you press to show other icons. That's where all other apps icons go by default. Please see image I added.
Sergey Alexandrovich Kryukov 28-Sep-12 17:23pm
   
This is exactly how such applications look. For example:
http://www.codeproject.com/Articles/36468/WPF-NotifyIcon

--SA
Rokas Gustys 29-Sep-12 16:54pm
   
It doesn't seem to do what I want though (in Win 7 at least). Please see my second edit.
Sergey Alexandrovich Kryukov 30-Sep-12 19:18pm
   
I see what you mean now...
--SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You don't have control over this in your app. It's based entirely on a "whoever gets there first, wins" basis.
  Permalink  
Comments
Rokas Gustys 28-Sep-12 16:20pm
   
No, you don't get what I mean...

If your on Windows 7, go into control panel and go to Notification Area Icons. You will see what I mean. All notification area icons can be adjusted to be shown all the time or not. I'm just trying to find a way to do it programmatically.

And as I said, if DropBox can do it, then it is possible. There must be some API or something.
Dave Kreskowiak 29-Sep-12 14:36pm
   
It's Windows 7 and I know what you're trying to do. You still have no control over it. From MSDN:

Windows 7 has gone a step further by focusing the notification on its original purpose of being a notification source. Most icons are hidden by default in Windows 7, but can be promoted to the notification area manually, by the user. To keep users in control of their desktops, there is no way for your program to perform this promotion automatically. Windows still displays notifications for hidden icons by promoting them temporarily.

Also, read http://blogs.msdn.com/b/oldnewthing/archive/2010/12/15/10105142.aspx

Rokas Gustys 29-Sep-12 15:12pm
   
Yes, I have realized that now. See my second edit...
Dave Kreskowiak 29-Sep-12 15:48pm
   
Yeah, what part of "there is no way for your program to perform this" don't you understand??
Rokas Gustys 29-Sep-12 15:49pm
   
Yes there is!!! DropBox and quite a few Anti-Virus programs did it so yes it is possible to do it!!!

Please don't bother replying if you don't know how...
Dave Kreskowiak 29-Sep-12 16:27pm
   
But the one thing you won't listen to is that it is only happening by coincidence! On my machine, Dropbox shows up in position 4, 5 or 6 depending on what starts first. Steam can show up in any position, usually after 3, but as far back as last, and I've got 17 icons in the tray.

It shows up 1st on your machine, not because of an API call, but because its process usually starts and puts up its icon first.
Rokas Gustys 29-Sep-12 16:45pm
   
So is it a coincidence that it's icon appears next to the clock every time I reinstall and will not become hidden unless I close it or go into Control panel and set it to only display notifications?

I've also installed it on my laptop and tried it on one of my friends PC's, it always appears next to the clock and it will never become hidden until the user moves it to the rest of the icons or sets it to only display notifications from control panel.

So it's clearly something to do with your set up... It's not a coincidence.
Dave Kreskowiak 29-Sep-12 16:27pm
   
From here on out, you're on your own.

Unsubscribe.
Rokas Gustys 29-Sep-12 16:50pm
   
No matter how many times I try to re-explain, we clearly don't understand each other correctly. It's OK...
I know it's possible, so I'll find a way. Maybe on a different forum...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

There is no API[^] for it, sorry. Windows was designed this way on purpose.

However, I image the options are stored somewhere in the registry, so you may want to dig around there.
  Permalink  
Comments
Rokas Gustys 28-Sep-12 16:57pm
   
The only thing in the registry is to either show all hidden icons or hide them (default).

Please, if you don't know how then don't even bother. I know it's possible as I said DropBox has done it!!!
lewax00 28-Sep-12 19:12pm
   
It didn't when I installed it to my machine. I think what happens is the first so many programs that add their icon there get marked that way, and any after that don't (I had a lot of programs in my tray already).
Rokas Gustys 29-Sep-12 16:55pm
   
Are you running Windows 7?
lewax00 29-Sep-12 17:03pm
   
Yup.
Dave Kreskowiak 28-Sep-12 20:07pm
   
Dropbox does it on YOUR machine. It's not sitting over there on mine.
Rokas Gustys 29-Sep-12 5:19am
   
I don't know what OS you're running, but my app is for Windows 7+ anyway... If you are running Windows 7, then you clearly don't understand what I mean (No ones else here seems to either...).
Any application with a NotifyIcon is by default just displaying notifications and is being hidden unless the user goes into "Control Panel\All Control Panel Items\Notification Area Icons" and changes it to also display the icon. That is exactly what DropBox is doing, but programmatically...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

According to Microsoft, it is not possible to do this.

Quote:
There is no way for applications to programmatically always show themselves top level on the system tray either on first install or at any time during runtime. This is one of several changes we’ve made in Windows 7 in an effort to produce a cleaner, quieter desktop that is in the user’s control to customize the top level with their favorite applications and icons.


One thing to note is that Windows seems to remember the settings you choose when you uninstall an application, and then reinstall it. Is it possible that this is what happened?

When I installed DropBox on my Win8 desktop and my Win7 laptop, the icon was hidden until I manually went in and set it to "Show icon and notifications".


What would be really nice is if Windows detected this icon when DropBox (or any app that has an icon) was first installed, and prompted the user to Always hide, or Show Notifications, or Always Show. That would probably go against their "effort to produce a cleaner, quiter desktop" though, so it probably wouldn't happen.
  Permalink  
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

For those who keep telling that it's impossible... Here's the C# code: http://hianz.wordpress.com/2012/07/13/modify-windows-7-notification-area/[^]
The downside of this code is that you need to kill explorer.exe and rerun it in order for the changes to take effect and not overridden in next windows startup

@Rokas, I am at the same side that you are. Dropbox icon is always shown in tray icon no matter on what system I install it. I even did a fresh install of windows 7 and then I installed Dropbox, it never changed to be hidden and stayed in notification area, I looked at its notification settings and it was set to "Show icon and Notifications".
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 17 Jul 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100