Trigger event prior to shutdown

M

Mike Lewis

I have a custom console application that I would like to shutdown prior to
Windows Logoff/Shutdown. The console app connects to an ActiveX server. If
the console app is not disconnected from the server at shutdown, the server
prompts the user with a dialog box, which is undesired. Is there any way to
trigger the shutdown prior to Windows sending the
wm_queryendsession/wm_close messages? Thanks!
 
M

Mike Lewis

I found a solution that might be useful to others. It's really a design
strategy. In the original version of my app, the main form was the
container for the ActiveX component that connected to the ActiveX server.
While it was in memory, it retained a connection to the server. I created a
second non-visual window and put the control on that form. Then I captured
the wm_QES message and unloaded the second window from memory and let
windows logoff/shutdown continue normally.
 

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