Trigger event prior to shutdown

  • Thread starter Thread starter Mike Lewis
  • Start date Start date
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!
 
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.
 
Back
Top