Hello.
I have a tray only application.
In the constructor of the ApplicationContext derived class, in some cases (process already running), I have to close the application.
Can't find any way to do this.
ApplicationContext.ExitThread does not work.
Application.Exit neither.
Any idea?
class Client : ApplicationContext
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[
STAThread]
static void Main(string[] a_sArgs)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Client());
}
/// <summary>
/// Tray icon.
/// </summary>
NotifyIcon m_niTrayIcon = new NotifyIcon();
/// <summary>
///
/// </summary>
Client()
{
if (...my exit condition...)
{
// Stop�
ExitThread(); // Does not work.
return;
}
m_niTrayIcon.Icon =
new Icon(...);
m_niTrayIcon.Visible =
true;
}
}