tags:

views:

132

answers:

3

I've got an application (that is targetting .Net Framework 2.0) that is running on startup of the System, and I'm trying to get a NotifyIcon to display.

When my program starts up when a user either Runs it normally or is started as a child process after the system has already logged on everything is fine.

If my application starts up as the system is performing an AutoLogon using POSReady2009 (basically XP with Single User set). Then the NotifyIcon never becomes active.

If you subsequently check (in a timer) the .Visible of the Icon at any point later it always reports that it is visible = true.

If you disable the SSDPSrv and restart the Computer, the Icon displays correctly. I have a sneaking suspicion this is related to .Net 3.5sp1 installed over the top of a .Net 2 system.

Is there some process that I should be following to ensure that my NotifyIcon is always available to the user.

I have setup RegisterWindowMessage("TaskbarCreated") but I don't get this message called, except when you forcilbly Kill Explorer.exe and restart it. Even so, a NotifyIcon interally registers for these notifications anyway, so it shouldn't be required.

I'm happy to stall the startup of my program, but once the program starts up, I expect that the icon shows correctly.

If there is a KB article that I cannot find detailing this I'd be happy with that too.

+1  A: 

Hmm... that's odd.

This may not work, and it's possibly not the best way of doing it - but first of all try putting NotifyIcon1.Visible = True in the Load event.

If that isn't working why not try adding this into a timer...

NotifyIcon1.Visible = False
NotifyIcon1.Visible = True

This should then hide and show the icon everytime the timer ticks, at least then you can see if it's working. Maybe only run the timer 10 times and then it ends, that way the script should hide and show the icon 10 times by which time the system should be ready.

Let me know if this works - if not I'll have a scratchy beard moment and have another think!

Blind Trevor
tried this, but it really comes down to just what is starting up on the system. Remembering it's not an issue if the program is started by windows explorer. Only if the program is started as a Child of anothere program (which ironically was started by windows explorer)... StartMenu->Startup
Paul Farry
+1  A: 

Well it's kinda dumb but have endedup needing to modify the process of startup to deal with this issue.

Made the program it's own shortcut that get's placed into the Startup folder by our installer.

The program that triggers this no longer starts it automatically. Instead we inform the other program once we have started up (Dropping a trigger file).

The other program then monitors if the user closes us OR we just crash and automatically re-opens the program. [There is a proper process to follow if you wish to fully close down the system]

Inside the startup of the program we check to see if the SSDP service is available and Not set to Disabled.. if so, wait until this service has started. We then check that SQLServer is running.

We then prepare the NotifyIcon and set it's .visible= true and all is good.

Still have kept the RegisterWindowMessage in the event the user somehow kills windows explorer.

Paul Farry
A: 

I am facing the same problem. If anyone know the solution please help me.

Nazmul