Easiest way to have a program minimize itself to the system tray using .NET 4

Example in MSDN forum Here’s a quick example to show how to minimize to the notification area. You need to add references to the System.Window.Forms and System.Drawing assemblies. public partial class Window1 : System.Windows.Window { public Window1() { InitializeComponent(); System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon(); ni.Icon = new System.Drawing.Icon(“Main.ico”); ni.Visible = true; ni.DoubleClick += delegate(object sender, … Read more

How to restore a minimized Window in code-behind?

Not sure this will work for everybody, but I ran into this today and someone on the team suggested “have you tried Normal“? Turns out he was right. The following seems to nicely restore your window: if (myWindow.WindowState == WindowState.Minimized) myWindow.WindowState = WindowState.Normal; That works just fine, restoring the window to Maximized if needed. It … Read more

What do you use to minimize and compress JavaScript libraries? [closed]

I’ve used YUI Compressor for a long time and have had no problems with it, but have recently started using Google Closure Compiler and had some success with it. My impressions of it so far: It generally outperforms YUI Compressor in terms of file size reduction. By a small amount on simple mode, and by … Read more

How do I put a Java app in the system tray?

As of Java 6, this is supported in the SystemTray and TrayIcon classes. SystemTray has a pretty extensive example in its Javadocs: TrayIcon trayIcon = null; if (SystemTray.isSupported()) { // get the SystemTray instance SystemTray tray = SystemTray.getSystemTray(); // load an image Image image = Toolkit.getDefaultToolkit().getImage(“your_image/path_here.gif”); // create a action listener to listen for default … Read more