Got an odd problem. 9 months ago I wrote a windows service that displayed a message to staff. The service was set to interact with desktop so that the window would display when required.
The Topmost property is set to true
Now, with no change to the code and after many months of this working perfectly the window now does not display on top af all other windows on ALL work PC's. But on my development PC which is not part of the work network it still works perfectly.
I use VB.net 2005.

Topmost problem when used in a service
Denis Pitcher
pd_tch
Hi all!
We are running into the same problem as described above.
A few students told us about this behaviour a few days ago and in my tests
I have noticed it will occur the first time someone wants to print in any application.
When you print the second time everything works fine.
We have a service running on all student PCs displaying a message (=form)
to our students when they want to print (service: allow to interact with desktop is enabled)
Now I have read the above posts but before changing my code and re-deploying the new
software to all the student PCs I would like to clarify a few things:
- the above entries have been posted one year ago:
have their been any changes/fixes so far
- why does IE7 make such a huge system-wide change
- what actually does IE7 change (is it again by-design ;-)
- Possible workaround
Display an "unvisible" form first and immediatly afterwards the second real form.
(second and all following messages (forms) are displayed correctly)
Best regards,
Hans
Erick-Flores
Hi Guys
We also have this problem. We are writing an app that pops up little "toast" messages, and I just noticed that on my PC they no longer stay on top as they used to, and had no idea why, so I'm glad I found this thread, having recently upgraded to IE7. We have now tried the app on other PCs that are running IE7, and also on PCs running IE6 (W98 and W2K - not yet XP) and it does indeed seem that IE7 is the common factor.
The scary thing is that it is not just the IE7 program itself that forces the TopMost form off the top - all applications do. The TopMost property simply stops working. Call me naive, but IE is, or should be, just an application. That it can have this sort of system-wide effect on Windows' behaviour is horrifying!
Anyway, we have to date found no way around this problem. Having searched the web it doesn't seem to be a well know bug - this is the only reference I have found so far. If anyone has any ideas or other references we'd be very glad to hear about them
nemo kao
Well there is one solution.... remove IE7... ;)
Minherz
Hey guys, after a bit of testing I've worked out what is causing this issue.
It's IE7. All PC's with IE6 behave normally.
Any news on updates to correct this issue please
Eric Liprandi
Hi Martyn775,
I found this thread looking for a solution to the same problem - only my application resides in the system tray. I did confirm that it works fine under IE6, but not IE7, by testing in VirtualPC.
I think this is a threading issue and not a general problem with Topmost. What I HAD been doing was creating my notification form in a static function, then starting a new thread to run the form on. This static function was called from an event handler, so it was not being run by the app's main thread.
I did two things to fix this. First, I invoked a delegate from my event handler to pass execution to my primary thread, which is a windows form. Then, I just called Show() from my static function, rather than creating a new thread.
In the old scenario, I couldn't just call show because the executing thread at that point wasn't a winform.
I don't know what this is going to mean for you, since you're running a service and not a form app. You can't do an invoke without a window handle. Maybe the key is having an ApplicationContext, and you could play with that...
Good luck, and post back if you solve your problem! Let me know if I can throw some code your way.
Jim