|
// Shoe_Tray - Show Hide Outlook Express, Sits in System Tray allows Hide and Show of Outlook Express.
// Copyright (C) 2002 Tracy Anne Barlow, TracyAnne Software
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Resources;
using System.Diagnostics;
namespace Shoe_Tray
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmMain : System.Windows.Forms.Form
{
private System.Windows.Forms.NotifyIcon Shoe_Tray_Icon;
private System.Windows.Forms.ContextMenu Shoe_Tray_Context_Menu;
private System.Windows.Forms.MenuItem ShowOutlookExpress;
private System.Windows.Forms.MenuItem HideOutlookExpress;
private System.Windows.Forms.MenuItem ShutDownThisApplication;
private System.Windows.Forms.Label Label1;
private System.Windows.Forms.MenuItem MenuSpacer2;
private System.Windows.Forms.MenuItem AboutShowHideOutlookExpress;
private System.Windows.Forms.MenuItem menuItem1;
private System.ComponentModel.IContainer components;
private ExternalApplication.ExternalApplication XE;
private int hWnd;
private Form MsgForm = new Shoe_Tray.Form1();
public frmMain()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
XE = new ExternalApplication.ExternalApplication("C:\\Program Files\\Outlook Express\\msimn.exe");
XE.WindowTitle = "Inbox - Outlook Express";
XE.CallingForm = this;
XE.MessageForm = MsgForm;
XE.Start(System.Diagnostics.ProcessWindowStyle.Hidden);
this.ShowOutlookExpress.Enabled = true;
this.HideOutlookExpress.Enabled = false;
this.Shoe_Tray_Icon.Text = "Show Outlook Express";
hWnd = (int)XE.MainWindowHandle;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
this.Shoe_Tray_Icon = new System.Windows.Forms.NotifyIcon(this.components);
this.Shoe_Tray_Context_Menu = new System.Windows.Forms.ContextMenu();
this.ShowOutlookExpress = new System.Windows.Forms.MenuItem();
this.HideOutlookExpress = new System.Windows.Forms.MenuItem();
this.MenuSpacer2 = new System.Windows.Forms.MenuItem();
this.AboutShowHideOutlookExpress = new System.Windows.Forms.MenuItem();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.ShutDownThisApplication = new System.Windows.Forms.MenuItem();
this.Label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// Shoe_Tray_Icon
//
this.Shoe_Tray_Icon.ContextMenu = this.Shoe_Tray_Context_Menu;
this.Shoe_Tray_Icon.Icon = ((System.Drawing.Icon)(resources.GetObject("Shoe_Tray_Icon.Icon")));
this.Shoe_Tray_Icon.Text = "Show Hide Outlook Express";
this.Shoe_Tray_Icon.Visible = true;
this.Shoe_Tray_Icon.DoubleClick += new System.EventHandler(this.Shoe_Tray_Icon_DoubleClick);
//
// Shoe_Tray_Context_Menu
//
this.Shoe_Tray_Context_Menu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.ShowOutlookExpress,
this.HideOutlookExpress,
this.MenuSpacer2,
this.AboutShowHideOutlookExpress,
this.menuItem1,
this.ShutDownThisApplication});
//
// ShowOutlookExpress
//
this.ShowOutlookExpress.Enabled = false;
this.ShowOutlookExpress.Index = 0;
this.ShowOutlookExpress.Text = "Show";
this.ShowOutlookExpress.Click += new System.EventHandler(this.ShowOutlookExpress_Click);
//
// HideOutlookExpress
//
this.HideOutlookExpress.Index = 1;
this.HideOutlookExpress.Text = "Hide";
this.HideOutlookExpress.Click += new System.EventHandler(this.HideOutlookExpress_Click);
//
// MenuSpacer2
//
this.MenuSpacer2.Index = 2;
this.MenuSpacer2.Text = "-";
//
// AboutShowHideOutlookExpress
//
this.AboutShowHideOutlookExpress.Index = 3;
this.AboutShowHideOutlookExpress.Text = "About";
this.AboutShowHideOutlookExpress.Click += new System.EventHandler(this.AboutShowHideOutlookExpress_Click);
//
// menuItem1
//
this.menuItem1.Index = 4;
this.menuItem1.Text = "-";
//
// ShutDownThisApplication
//
this.ShutDownThisApplication.Index = 5;
this.ShutDownThisApplication.Text = "Quit";
this.ShutDownThisApplication.Click += new System.EventHandler(this.ShutDownThisApplication_Click);
//
// Label1
//
this.Label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(194, 15);
this.Label1.TabIndex = 0;
this.Label1.Text = "This Form should always be invisible";
//
// frmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(194, 15);
this.ControlBox = false;
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.Label1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmMain";
this.Opacity = 0;
this.ShowInTaskbar = false;
this.Text = "Show Hide Outlook Express";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Loads the Application into System Tray
Application.Run(new frmMain());
}
private void ShowOutlookExpress_Click(object sender, System.EventArgs e)
{
//Call to ProcessOutlookExpress Class
XE.ShowApplication();
this.ShowOutlookExpress.Enabled = false;
this.HideOutlookExpress.Enabled = true;
this.Shoe_Tray_Icon.Text = "Hide Outlook Express";
}
private void HideOutlookExpress_Click(object sender, System.EventArgs e)
{
//Call to ProcessOutlookExpress Class
XE.HideApplication();
this.ShowOutlookExpress.Enabled = true;
this.HideOutlookExpress.Enabled = false;
this.Shoe_Tray_Icon.Text = "Show Outlook Express";
}
private void ShutDownThisApplication_Click(object sender, System.EventArgs e)
{
try
{
XE.Kill();
}
catch
{}
XE.Close();
XE.Dispose();
this.Close();
}
private void AboutShowHideOutlookExpress_Click(object sender, System.EventArgs e)
{
Form AboutForm = new CsharpAboutBox.AboutForm();
AboutForm.ShowDialog();
}
private void Shoe_Tray_Icon_DoubleClick(object sender, System.EventArgs e)
{
if ( XE.IsVisibleWindow() )
{
HideOutlookExpress_Click(this.HideOutlookExpress, null);
}
else
{
ShowOutlookExpress_Click(this.ShowOutlookExpress, null);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.