SuperPutty.ApplicationPanel.OnHandleDestroyed C# (CSharp) Method

OnHandleDestroyed() protected method

Send a close message to the hosted application window when the parent is destroyed
protected OnHandleDestroyed ( EventArgs e ) : void
e System.EventArgs
return void
        protected override void OnHandleDestroyed(EventArgs e)
        {
            if (this.ExternalProcessCaptured)
            {
                // Send WM_DESTROY instead of WM_CLOSE, so that the Client doesn't
                // ask in the Background whether the session shall be closed.
                // Otherwise an annoying beep is generated everytime a terminal session is closed.
                NativeMethods.PostMessage(m_AppWin, NativeMethods.WM_DESTROY, 0, 0);

                System.Threading.Thread.Sleep(ClosePuttyWaitTimeMs);

                m_AppWin = IntPtr.Zero;
            }

            base.OnHandleDestroyed(e);
        }