Hi,
I think Adnan might be asking that when he minimized a window to the system
tray, the SessionEnded event is not fired. Right?
I have tried it on my machine, and it works fine under any circumstances.
Please try my code in a new windows application.
private void Form1_Load(object sender, System.EventArgs e)
{
Microsoft.Win32.SystemEvents.SessionEnded +=new
Microsoft.Win32.SessionEndedEventHandler(SystemEvents_SessionEnded);
this.Resize +=new EventHandler(Form1_Resize);
}
private void SystemEvents_SessionEnded(object sender,
Microsoft.Win32.SessionEndedEventArgs e)
{
MessageBox.Show("End");
}
private void Form1_Resize(object sender, EventArgs e)
{
if(this.WindowState == FormWindowState.Minimized)
{
this.ShowInTaskbar = false;
this.notifyIcon1.Visible=true;
}
else
this.ShowInTaskbar = true;
this.notifyIcon1.DoubleClick+=new EventHandler(notifyIcon1_DoubleClick);
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
this.notifyIcon1.Visible = false;
}
HTH.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."