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

VB.NET

    Next

  • 1. Generic List Find.
    On Oct 18, 2:56 pm, Satish Itty < XXXX@XXXXX.COM > wrote: > How do I write the following c# code in vb > > Product FindProduct(string code) > { > List<Product> products = getProducts(); > return products.Find(delegate(Product bo) > { return bo.Code == code; }); > > > > }- Hide quoted text - > > - Show quoted text - Function FindProduct (ByVal code As String) As Product Dim products As List(Of Product) = GetProducts() Dim pred As New PredicateClass(code) Return products.Find (AddressOf pred.PredicateFunction) End Function Private Class PredicateClass Private code As String Public Sub New (ByVal code As String) Me.code = code End Sub Public Function PredicateFunction (ByVal bo As Product) As Boolean Return bo.Code = Me.code End Function End Class Anyway, that should be a good approximation (I just did that off the top of my head, so it's not tested, and may actually contain some stray C# syntax :)... Man am I grateful for anonymous methods in C# :)
  • 2. OT
    Howdy Cor - Good afternoon now!! Isn't it nice to be able to 'converse' again without having to wait several hours and then be afraid to click on a message in case it disappears!! I agree that storing multiple copies of a mail is silly, however I don't believe this is John's intention. || You know, some like the tango others the quickstep. LOL. And others have a style involving drumsticks and a lot of space which can't* be named!! ;-)) Cheers, Fergus * Actually I'm sure many people <have> got a name for it but I'm not going to let that put me off!!
  • 3. Need later version MSDN
    Hello all. I have finally bitten the bullet and seriously started to learn VB.NET. I have the developement enviromnent installed and integrated my latest MSDN dated July 2005. If someone is thru with a later version ( say Oct 2006, Jan 2007 or so ) and would let me have it, I will gladly pay shipping and handling cost for it. Thanks in advance, Jim Richards

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

Postby Patrick Dugan » Thu, 03 May 2007 01:20:03 GMT

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?



Re: System tray icon does not always show when starting app when Windows starts

Postby Newbie Coder » Thu, 03 May 2007 11:08:05 GMT

Patrick,

You can handle this many ways, but here are a couple:

1) Check to see if the process is already running
2) Embed the icon in the executable

By continuing to create a new NotifyIcon object you are indeed using memory

How are you starting this application?

Hopefully you are using a module with sub main, creating an instance of your
form & running it from there. If not, you should because then you can hide
the form, display the tray icon like you want. I have a few VB.NET
applications running on startup like you wish without problems doing it the
sub main way

-- 
Newbie Coder
(It's just a name)




created
delay



Re: System tray icon does not always show when starting app when Windows starts

Postby Patrick Dugan » Thu, 03 May 2007 21:27:21 GMT

The icon is embedded in the main program and it is called from an instance 
in sub main.  The problem is *sometimes* the icon will not show up if the 
program is set to start when Windows boots up.  The problem is rare but 
nonetheless still happens on occassion. The question is how do I determine 
that the system tray has started so I can wait to initialize the icon at 
that point.  I already know to look for a process but so far I cannot tell 
what process indicates the system tray is up and running.

I also need to determine if Explorer crashes and the tray icons need to be 
refreshed.  How can you tell that has happened and you need to re-establish 
the tray icon?










Re: System tray icon does not always show when starting app when Windows starts

Postby G Himangi » Sun, 06 May 2007 20:45:20 GMT

hen the taskbar is recreated, the system sends the registered window
message "TaskbarCreated" whose value you can get using
RegisterWindowMessage("TaskbarCreated");

You will need to catch this message and reinsert the tray icon

If you dont mind a commercial solution, you can try our ShellNotifyIcon
component at http://www.ssware.com/shlobj/shlobj.htm

---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------





"Patrick Dugan" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...



Similar Threads:

1.Office 2k Installer always starts when I start a VB APP

On windows 2003 server with terminal services activated we 
have Office Proffessional install and configured with 
other applications wriiten in VB. Our problem is each time 
we start the VB application it starts the Office installer 
and the same user can go through the installation and 
logoff and then relogin the installer starts again. I have 
installed Office with all the options set to Run From my 
Local Machine and yet still I have this problem. I will 
appreciate any helkp I can get on this issue.

Thanks

2.system tray icons lost if explorer shuts down/re-starts

hi

i have an app that places an icon in the system tray and the main form can 
only be shown by clicking the icon in the systray.
the app ensures that it's the only instance running to prevent having 
multiple icons in the system tray for the same purpose

however i have a problem: if for any reason windows explorer is terminates, 
when it re-starts the icon is no longer in the system tray but the app is 
still running.
Users complain that they must reboot to get the program working again.
i've noticed that some software is able to recover from this problem and as 
soon as windows explorer re-starts some icons re-appear.

must i use some hack when I add the app to the system tray? I'm using the 
regular NIM_ADD with flags "NIF_ICON Or NIF_MESSAGE Or NIF_TIP".
is there any way to work around this issue?

thanks
pedro


3.Starting VB app causes Windows Installer to start

When I start a VB app on a Windows XP SP2 machine, I get a dialog from 
Windows Installer with the following dialog: Please wait while Windows 
configures Microsoft Office XP... Gathering required information.

If I sign on as a different user, I don't get the dialog.  I thought it was 
an issue with his profile, so I re-created it but I still get the same 
error.  The program had worked fine until a couple of days ago.  There 
hasn't been any changes to the machine at all.

Any help would be appreciated.

Thanks 


4.Windows installer starts when vb app starts

I have a PC that will start the windows installer program when a vb app 
starts.  It is trying to configure MS Office XP for some reason.  If the 
user has admin rights on the machine, I don't get the dialog box.  Any ideas 
what would cause this behavior?

Thanks 


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

6. app's designed icon not displayed in Start Menu

7. Control when to Hide/Show Inactive System Tray Icon

8. Debugged app does not always start



Return to VB.NET

 

Who is online

Users browsing this forum: No registered users and 76 guest