System.Diagnostics.Process.CloseMainWindow(), WM_CLOSE, SC_CLOSE

  • Thread starter Thread starter temp20080330
  • Start date Start date
T

temp20080330

My application runs minimized from a system tray and when
CloseMainWindow() is invoked the application does not get the close
request. When the applications displays a dialog box then
CloseMainWindow() works fine. In general this is not good since I can
not predict/force the application out of the system tray.

System.Diagnostics.Process.CloseMainWindow() is essentially a Native
Win32 SendMessage/PostMessage with WM_CLOSE

On the other hand if I use unmanaged code to call SendMessage with
SC_CLOSE, my application running minimized in the system tray gets the
request and closes gracefully.


My question what piece of the .NET framework will send SC_CLOSE?

TIA,

Jeff
 
Back
Top