Control when to Hide/Show Inactive System Tray Icon

Visual Basic


  • 1. How to force vbasic ide to show long file names instead of 8.3
    Hello, After reinstalling Windows my vbasic started using 8.3 format for displaying file names. What should be done to correct that? Jack
  • 2. Tree view problem
    Hi, I'm using a tree view to manage my tables. The nodes are made dynamiclly, the problem that I want to create an event when I select a node. I used the code below treeview.selectednode.index = 0 but when I use that code the event run on all nodes and children nodes I want to associate an index to each node to resolve that problem Does any one had solution Omar Abid
  • 3. Command line builds
    Is there a way to build an executable from the command Line AND change the version numbers of the executable? -Lou
  • 4. Access report filter
    How can I get VBA to set the filter property of an Access report (as I would manually by going into design mode and typing the criteria into the property window). I have used VBA in Excel some, using the record macro feature to learn how to address objects, but I have no idea where to start with Access. Please help. rk

Control when to Hide/Show Inactive System Tray Icon

Postby Jerry McMorran » Thu, 02 Dec 2004 01:49:15 GMT

For Windows XP, inactive system tray icons will be hidden automatically according to the user's OS settings.
I know I could send a "modify" message at constant time interval to prevent my icon from being inactive. However, I would like to be
more flexible....
When you right-click the XP's task bar, you can set such settings for each icon. There are 3 choices available: "Hide if inactive",
"Always show", "Always hide".
What I'm thinking of is that are there any APIs or Registry entries to control the settings for a specific icon only? Or how to
modify those OS settings programmatically?

Thanks in advance!

Re: Control when to Hide/Show Inactive System Tray Icon

Postby Ken Halter » Thu, 02 Dec 2004 02:23:30 GMT

I haven't tried but..... here's some code.

Subject: Making certain programs' tray icons "always show" programatically

Ken Halter - MS-MVP-VB -  http://www.**--****.com/ 
Please keep all discussions in the groups.. 

Re: Control when to Hide/Show Inactive System Tray Icon

Postby Jerry McMorran » Thu, 02 Dec 2004 03:56:37 GMT

Thanks! I finally see some code for this.
At a glance, the code is accessing the registry and modify the "TrayNotify" key's "IconStreams" value.
However, I tried to export the content of that key to a .reg file first. Then I changed an icon from "Hide when unused" to "Show
always" by right clicking on the taskbar. And I then do another export again. I do a diff (file compare) on the 2 .reg files, they
are the same...
Where did the change go?

"Ken Halter" < XXXX@XXXXX.COM > :# XXXX@XXXXX.COM ...

Re: Control when to Hide/Show Inactive System Tray Icon

Postby Jerry McMorran » Thu, 02 Dec 2004 04:16:37 GMT

Oh, I've found out the reason.
It's been mentioned subsequent messages in the thread.

"Jerry McMorran" < XXXX@XXXXX.COM > ???????: XXXX@XXXXX.COM ...

Similar Threads:

1.Hide icon in system tray

On 31 Jul 2003 21:26:22 -0500, Roger Glover < XXXX@XXXXX.COM > wrote:

>When I use a routine to put a app in the sytem tray it is easy enough to hide
>the form:If Me.WindowState = vbMinimized Then Me.Hide
>However when the form is shown I want the icon hidden in the tray.I can delete
>it but then i have to recreate it again.i just want to hide it when the form is

Nope. It's either there or it's not. However what you could do is
replace it with a completely transparent icon when the form is hidden.

MVP - Visual Basic
(please post replies to the newsgroup)

2.System tray icon does not always show when starting app when Windows starts

I am using VS2005 (vb) and I have a program that starts when Windows boots 
up.  Occasionally the icon that should appear in the system tray does not 
show up.  The program is still running in memory but the tray icon is not 
there.  If I start the program after Windows has booted up the icon shows 
every time.  I am assuming that the reason is due to the icon being created 
before the system tray is loaded/running.   I have used a timer with "dim 
notifyicon1 as new notifyicon" every few seconds and that works but I am 
afraid I am eating up memory doing that or is that "ok" to do?

Is there any way to detect if the system tray is not running so I can delay 
the creation of the tray icon until it is?

3.Remove Express Edition Tray icon from System Tray,...

4.Prevent tray icon from hiding automatically in XP?


    I've added a standard icon to the system tray using Shell_NotifyIcon() 
function but after several minutes Windows XP automatically hides it. This 
seems like normal behavior for some programs, but for others they stay 
visible all the time (ex. AIM, ZoneAlarm). How can I have my icon stay 
visible all the time?

    I've tried removing it and adding it again but it adds in the hidden 



5.Maximize/Show App when icon is clicked in tray

I am using the code to show my app when the app icon is double-clicked in 
the icon tray.

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, 
Y As Single)
Dim Result, Action As Long
 If Me.ScaleMode = vbPixels Then
  Action = X
  Action = X / Screen.TwipsPerPixelX
 End If
 Select Case Action
  Case WM_LBUTTONDBLCLK 'Left Button Double Click
   Me.WindowState = vbNormal 'show app
   Result = SetForegroundWindow(Me.hwnd)
 Case WM_RBUTTONUP 'Right Button Up
   Result = SetForegroundWindow(Me.hwnd)
   PopupMenu mnu_1 'show popup menu
 End Select
End Sub

 The strange thing is this code works perfectly in one app but doesn't work 
in another. When I double-click or right click icon of the "unworking" app 
in the icon tray form mouse move even does not fire. Anyone have an idea, 
been battling this problem for more than 2 days... can't figure it 
out....Please help!!!! 

6. Making certain programs' tray icons "always show" programatically

7. system tray icon with popup menu

8. How to remove icon from system tray?

Return to Visual Basic


Who is online

Users browsing this forum: No registered users and 58 guest