.net BroadcastEventWindow on logoff with complicated achitecture

C

Chris Bardon

I have a problem with an application that is popping up a ".net
BroadcastEventWindow" on shutdown/log off, and I can't seem to figure
out how to get rid of it. The problem is that the whole setup is a
little bit convoluted. I have a singleton COM server that uses
windows forms, and for the most part everything works as expected.
The forms each start their own threads, they all exit as expected if I
remove all instances to my COM singleton, and sometimes even exit
correctly on logoff. The problem comes when I register one of these
forms as an Appbar in windows to dock it at the top of the screen.

For the docked window, I've tried capturing the SessionEnding event on
the systemevents class, and I've overridden the WndProc and tried to
catch WM_QUERYENDSESSION, WM_QUIT, and WM_ENDSESSION. The window
still catches these messages when I log off, but not until after the
BroadcastEventWindow comes up and times out (and if I hit cancel).
I'm wondering-is there anonther way to detect log off/shutdown that
will come in before windows tries to kill the BroadcastEventWindow?
In addition to te above, the form's Closed and Closing events aren't
fired until after the BroadcastEventWindow error either, so I'm
starting to run out of options here. If I can come up with a way to
catch the log off before the error comes up, I should be able to exit
gracefully.

Anyone have any ideas? I know I'm not giving you much to go on here,
but I'm trying to put together a smaller sample that can replicate the
problem to post.

Thanks for the help,

Chris
 
C

Chris Bardon

Well, it turns out that there is a "solution" out there, even if it is
a bit of a cheat. If you look in the registry under HKCU\Control Panel
\Desktop there's a value called AutoEndTasks that you can set to 1 to
suppress all of those "End Task" dialogs. It looks like anything that
suppresses shutdown/logoff isn't affected by this, so really all it
does is force the OS to kill any lingering processes. True, not an
ideal solution, but one to try if you're running into similar
problems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top